Sfoglia il codice sorgente

use File::Basename if it exists to determine config directory
(closes #467107)

Bron Gondwana 23 anni fa
parent
commit
196ac5bdc4
1 ha cambiato i file con 13 aggiunte e 0 eliminazioni
  1. 13 0
      config/conf.pl

+ 13 - 0
config/conf.pl

@@ -8,6 +8,19 @@
 ############################################################              
 $conf_pl_version = "1.2.0";
 
+############################################################
+# Check what directory we're supposed to be running in, and
+# change there if necessary.  File::Basename has been in
+# Perl since at least 5.003_7, and nobody sane runs anything
+# before that, but just in case.
+############################################################
+
+if (eval q{require "File/Basename.pm"}) {
+    my $dir = File::Basename::dirname($0);
+    chdir($dir);
+}
+
+
 ############################################################              
 # Some people try to run this as a CGI. That's wrong!
 ############################################################