depot/pkgs/by-name/la/lanraragi/fix-paths.patch
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

100 lines
3.6 KiB
Diff

diff --git a/lib/LANraragi.pm b/lib/LANraragi.pm
index e6b833c4..4b90e4c5 100644
--- a/lib/LANraragi.pm
+++ b/lib/LANraragi.pm
@@ -21,6 +21,8 @@ use LANraragi::Utils::Minion;
use LANraragi::Model::Search;
use LANraragi::Model::Config;
+use FindBin;
+
# This method will run once at server start
sub startup {
my $self = shift;
@@ -30,7 +32,7 @@ sub startup {
say "キタ━━━━━━(゚∀゚)━━━━━━!!!!!";
# Load package.json to get version/vername/description
- my $packagejson = decode_json( Mojo::File->new('package.json')->slurp );
+ my $packagejson = decode_json( Mojo::File->new("$FindBin::Bin/../package.json")->slurp );
my $version = $packagejson->{version};
my $vername = $packagejson->{version_name};
diff --git a/lib/LANraragi/Model/Archive.pm b/lib/LANraragi/Model/Archive.pm
index 73e824dd..8bcea29c 100644
--- a/lib/LANraragi/Model/Archive.pm
+++ b/lib/LANraragi/Model/Archive.pm
@@ -13,6 +13,7 @@ use Time::HiRes qw(usleep);
use File::Basename;
use File::Copy "cp";
use File::Path qw(make_path);
+use FindBin;
use LANraragi::Utils::Generic qw(remove_spaces remove_newlines render_api_response);
use LANraragi::Utils::TempFolder qw(get_temp);
@@ -126,7 +127,7 @@ sub serve_thumbnail {
} else {
# If the thumbnail doesn't exist, serve the default thumbnail.
- $self->render_file( filepath => "./public/img/noThumb.png" );
+ $self->render_file( filepath => "$FindBin::Bin/../public/img/noThumb.png" );
}
return;
diff --git a/lib/LANraragi/Utils/Generic.pm b/lib/LANraragi/Utils/Generic.pm
index 14736893..4352f023 100644
--- a/lib/LANraragi/Utils/Generic.pm
+++ b/lib/LANraragi/Utils/Generic.pm
@@ -17,6 +17,8 @@ use Sys::CpuAffinity;
use LANraragi::Utils::TempFolder qw(get_temp);
use LANraragi::Utils::Logging qw(get_logger);
+use FindBin;
+
# Generic Utility Functions.
use Exporter 'import';
our @EXPORT_OK =
@@ -161,7 +163,7 @@ sub start_shinobu {
my $mojo = shift;
my $proc = Proc::Simple->new();
- $proc->start( $^X, "./lib/Shinobu.pm" );
+ $proc->start( $^X, "$FindBin::Bin/../lib/Shinobu.pm" );
$proc->kill_on_destroy(0);
$mojo->LRR_LOGGER->debug( "Shinobu Worker new PID is " . $proc->pid );
@@ -201,7 +203,7 @@ sub get_css_list {
#Get all the available CSS sheets.
my @css;
- opendir( my $dir, "./public/themes" ) or die $!;
+ opendir( my $dir, "$FindBin::Bin/../public/themes" ) or die $!;
while ( my $file = readdir($dir) ) {
if ( $file =~ /.+\.css/ ) { push( @css, $file ); }
}
diff --git a/lib/LANraragi/Utils/Logging.pm b/lib/LANraragi/Utils/Logging.pm
index ee29c507..6bdfc1bd 100644
--- a/lib/LANraragi/Utils/Logging.pm
+++ b/lib/LANraragi/Utils/Logging.pm
@@ -18,7 +18,7 @@ our @EXPORT_OK = qw(get_logger get_plugin_logger get_logdir get_lines_from_file)
# Get the Log folder.
sub get_logdir {
- my $log_folder = "$FindBin::Bin/../log";
+ my $log_folder = "./log";
# Folder location can be overriden by LRR_LOG_DIRECTORY
if ( $ENV{LRR_LOG_DIRECTORY} ) {
diff --git a/lib/LANraragi/Utils/TempFolder.pm b/lib/LANraragi/Utils/TempFolder.pm
index 792b1c1b..f0eb341b 100644
--- a/lib/LANraragi/Utils/TempFolder.pm
+++ b/lib/LANraragi/Utils/TempFolder.pm
@@ -20,7 +20,7 @@ our @EXPORT_OK = qw(get_temp get_tempsize clean_temp_full clean_temp_partial);
#Get the current tempfolder.
#This can be called from any process safely as it uses FindBin.
sub get_temp {
- my $temp_folder = "$FindBin::Bin/../public/temp";
+ my $temp_folder = "./public/temp";
# Folder location can be overriden by LRR_TEMP_DIRECTORY
if ( $ENV{LRR_TEMP_DIRECTORY} ) {