about summary refs log tree commit diff
path: root/pkgs/by-name/la/lanraragi/fix-paths.patch
blob: f545bd4759f7f302707b7dff9d8fe6477a6fa0e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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} ) {