nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 100 lines 3.7 kB view raw
1diff --git a/lib/LANraragi.pm b/lib/LANraragi.pm 2index e6b833c4..4b90e4c5 100644 3--- a/lib/LANraragi.pm 4+++ b/lib/LANraragi.pm 5@@ -21,6 +21,8 @@ use LANraragi::Utils::Minion; 6 use LANraragi::Model::Search; 7 use LANraragi::Model::Config; 8 9+use FindBin; 10+ 11 # This method will run once at server start 12 sub startup { 13 my $self = shift; 14@@ -30,7 +32,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 73e824dd..8bcea29c 100644 25--- a/lib/LANraragi/Model/Archive.pm 26+++ b/lib/LANraragi/Model/Archive.pm 27@@ -13,6 +13,7 @@ use Time::HiRes qw(usleep); 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(remove_spaces remove_newlines render_api_response); 34 use LANraragi::Utils::TempFolder qw(get_temp); 35@@ -126,7 +127,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 44diff --git a/lib/LANraragi/Utils/Generic.pm b/lib/LANraragi/Utils/Generic.pm 45index 14736893..4352f023 100644 46--- a/lib/LANraragi/Utils/Generic.pm 47+++ b/lib/LANraragi/Utils/Generic.pm 48@@ -17,6 +17,8 @@ use Sys::CpuAffinity; 49 use LANraragi::Utils::TempFolder qw(get_temp); 50 use LANraragi::Utils::Logging qw(get_logger); 51 52+use FindBin; 53+ 54 # Generic Utility Functions. 55 use Exporter 'import'; 56 our @EXPORT_OK = 57@@ -161,7 +163,7 @@ sub start_shinobu { 58 my $mojo = shift; 59 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@@ -201,7 +203,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/Logging.pm b/lib/LANraragi/Utils/Logging.pm 76index ee29c507..6bdfc1bd 100644 77--- a/lib/LANraragi/Utils/Logging.pm 78+++ b/lib/LANraragi/Utils/Logging.pm 79@@ -18,7 +18,7 @@ our @EXPORT_OK = qw(get_logger get_plugin_logger get_logdir get_lines_from_file) 80 # Get the Log folder. 81 sub get_logdir { 82 83- my $log_folder = "$FindBin::Bin/../log"; 84+ my $log_folder = "./log"; 85 86 # Folder location can be overriden by LRR_LOG_DIRECTORY 87 if ( $ENV{LRR_LOG_DIRECTORY} ) { 88diff --git a/lib/LANraragi/Utils/TempFolder.pm b/lib/LANraragi/Utils/TempFolder.pm 89index 792b1c1b..f0eb341b 100644 90--- a/lib/LANraragi/Utils/TempFolder.pm 91+++ b/lib/LANraragi/Utils/TempFolder.pm 92@@ -20,7 +20,7 @@ our @EXPORT_OK = qw(get_temp get_tempsize clean_temp_full clean_temp_partial); 93 #Get the current tempfolder. 94 #This can be called from any process safely as it uses FindBin. 95 sub get_temp { 96- my $temp_folder = "$FindBin::Bin/../public/temp"; 97+ my $temp_folder = "./public/temp"; 98 99 # Folder location can be overriden by LRR_TEMP_DIRECTORY 100 if ( $ENV{LRR_TEMP_DIRECTORY} ) {