use File::Basename if it exists to determine config directory
authorbrong <brong@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 15 Jan 2002 14:04:20 +0000 (14:04 +0000)
committerbrong <brong@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 15 Jan 2002 14:04:20 +0000 (14:04 +0000)
(closes #467107)

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2137 7612ce4b-ef26-0410-bec9-ea0150e637f0

config/conf.pl

index 2a6459e6c7119495eb0c073b02d955c93c4dbdc4..84c9d6e8bab02b83c8738da74601b43ef850dfa0 100755 (executable)
@@ -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!
 ############################################################