nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 139 lines 5.8 kB view raw
1diff --git a/lib/LANraragi.pm b/lib/LANraragi.pm 2index 1342d66..600ccbe 100644 3--- a/lib/LANraragi.pm 4+++ b/lib/LANraragi.pm 5@@ -25,6 +25,8 @@ use LANraragi::Model::Config; 6 7 use constant IS_UNIX => ( $Config{osname} ne 'MSWin32' ); 8 9+use FindBin; 10+ 11 # This method will run once at server start 12 sub startup { 13 my $self = shift; 14@@ -34,7 +36,7 @@ sub startup { 15 say "キタ━━━━━━(゚∀゚)━━━━━━!!!!!"; 16 17 # Load package.json to get version/vername/description 18- my $packagejson = decode_json( Mojo::File->new('package.json')->slurp ); 19+ my $packagejson = decode_json( Mojo::File->new("$FindBin::Bin/../package.json")->slurp ); 20 21 my $version = $packagejson->{version}; 22 my $vername = $packagejson->{version_name}; 23diff --git a/lib/LANraragi/Model/Archive.pm b/lib/LANraragi/Model/Archive.pm 24index 425f935..9483012 100644 25--- a/lib/LANraragi/Model/Archive.pm 26+++ b/lib/LANraragi/Model/Archive.pm 27@@ -14,6 +14,7 @@ use File::Path qw(remove_tree); 28 use File::Basename; 29 use File::Copy "cp"; 30 use File::Path qw(make_path); 31+use FindBin; 32 33 use LANraragi::Utils::Generic qw(render_api_response); 34 use LANraragi::Utils::String qw(trim trim_CRLF); 35@@ -222,7 +223,7 @@ sub serve_thumbnail { 36 } else { 37 38 # If the thumbnail doesn't exist, serve the default thumbnail. 39- $self->render_file( filepath => "./public/img/noThumb.png" ); 40+ $self->render_file( filepath => "$FindBin::Bin/../public/img/noThumb.png" ); 41 } 42 return; 43 } else { 44diff --git a/lib/LANraragi/Utils/Generic.pm b/lib/LANraragi/Utils/Generic.pm 45index 1b1ffbd..c0f87d6 100644 46--- a/lib/LANraragi/Utils/Generic.pm 47+++ b/lib/LANraragi/Utils/Generic.pm 48@@ -28,6 +28,8 @@ BEGIN { 49 } 50 } 51 52+use FindBin; 53+ 54 # Generic Utility Functions. 55 use Exporter 'import'; 56 our @EXPORT_OK = qw(is_image is_archive render_api_response get_tag_with_namespace shasum_str start_shinobu 57@@ -149,7 +151,7 @@ sub start_shinobu { 58 my $mojo = shift; 59 if ( IS_UNIX ) { 60 my $proc = Proc::Simple->new(); 61- $proc->start( $^X, "./lib/Shinobu.pm" ); 62+ $proc->start( $^X, "$FindBin::Bin/../lib/Shinobu.pm" ); 63 $proc->kill_on_destroy(0); 64 65 $mojo->LRR_LOGGER->debug( "Shinobu Worker new PID is " . $proc->pid ); 66@@ -198,7 +200,7 @@ sub get_css_list { 67 68 #Get all the available CSS sheets. 69 my @css; 70- opendir( my $dir, "./public/themes" ) or die $!; 71+ opendir( my $dir, "$FindBin::Bin/../public/themes" ) or die $!; 72 while ( my $file = readdir($dir) ) { 73 if ( $file =~ /.+\.css/ ) { push( @css, $file ); } 74 } 75diff --git a/lib/LANraragi/Utils/I18N.pm b/lib/LANraragi/Utils/I18N.pm 76index b917c2c..bee242e 100644 77--- a/lib/LANraragi/Utils/I18N.pm 78+++ b/lib/LANraragi/Utils/I18N.pm 79@@ -5,19 +5,22 @@ use warnings; 80 use utf8; 81 use base 'Locale::Maketext'; 82 83+# Technically, we could just not use FindBin::Bin, but then the search process 84+# would go through a lot of unnecessary effort to finally find the translations 85+use FindBin; 86 use Locale::Maketext::Lexicon { 87- en => [ Gettext => "../../locales/template/en.po" ], 88- es => [ Gettext => "../../locales/template/es.po" ], 89- zh => [ Gettext => "../../locales/template/zh.po" ], 90- "zh-cn" => [ Gettext => "../../locales/template/zh.po" ], 91- fr => [ Gettext => "../../locales/template/fr.po" ], 92- id => [ Gettext => "../../locales/template/id.po" ], 93- ko => [ Gettext => "../../locales/template/ko.po" ], 94- no => [ Gettext => "../../locales/template/nb_NO.po" ], 95- nb => [ Gettext => "../../locales/template/nb_NO.po" ], 96- pt => [ Gettext => "../../locales/template/pt.po" ], 97- "zh-tw" => [ Gettext => "../../locales/template/zh_Hant.po" ], 98- vi => [ Gettext => "../../locales/template/vi.po" ], 99+ en => [ Gettext => "$FindBin::Bin/../locales/template/en.po" ], 100+ es => [ Gettext => "$FindBin::Bin/../locales/template/es.po" ], 101+ zh => [ Gettext => "$FindBin::Bin/../locales/template/zh.po" ], 102+ "zh-cn" => [ Gettext => "$FindBin::Bin/../locales/template/zh.po" ], 103+ fr => [ Gettext => "$FindBin::Bin/../locales/template/fr.po" ], 104+ id => [ Gettext => "$FindBin::Bin/../locales/template/id.po" ], 105+ ko => [ Gettext => "$FindBin::Bin/../locales/template/ko.po" ], 106+ no => [ Gettext => "$FindBin::Bin/../locales/template/nb_NO.po" ], 107+ nb => [ Gettext => "$FindBin::Bin/../locales/template/nb_NO.po" ], 108+ pt => [ Gettext => "$FindBin::Bin/../locales/template/pt.po" ], 109+ "zh-tw" => [ Gettext => "$FindBin::Bin/../locales/template/zh_Hant.po" ], 110+ vi => [ Gettext => "$FindBin::Bin/../locales/template/vi.po" ], 111 _auto => 0, 112 }; 113 114diff --git a/lib/LANraragi/Utils/Logging.pm b/lib/LANraragi/Utils/Logging.pm 115index 7acbd01..b73ce3e 100644 116--- a/lib/LANraragi/Utils/Logging.pm 117+++ b/lib/LANraragi/Utils/Logging.pm 118@@ -19,7 +19,7 @@ our @EXPORT_OK = qw(get_logger get_plugin_logger get_logdir get_lines_from_file) 119 # Get the Log folder. 120 sub get_logdir { 121 122- my $log_folder = "$FindBin::Bin/../log"; 123+ my $log_folder = "./log"; 124 125 # Folder location can be overriden by LRR_LOG_DIRECTORY 126 if ( $ENV{LRR_LOG_DIRECTORY} ) { 127diff --git a/lib/LANraragi/Utils/TempFolder.pm b/lib/LANraragi/Utils/TempFolder.pm 128index a5ab8a8..64a5625 100644 129--- a/lib/LANraragi/Utils/TempFolder.pm 130+++ b/lib/LANraragi/Utils/TempFolder.pm 131@@ -13,7 +13,7 @@ our @EXPORT_OK = qw(get_temp); 132 #Get the current tempfolder. 133 #This can be called from any process safely as it uses FindBin. 134 sub get_temp { 135- my $temp_folder = "$FindBin::Bin/../temp"; 136+ my $temp_folder = "./temp"; 137 138 # Folder location can be overriden by LRR_TEMP_DIRECTORY 139 if ( $ENV{LRR_TEMP_DIRECTORY} ) {