[Rt-commit] r11945 - in rt/branches/3.8-TESTING: lib

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Apr 28 22:08:29 EDT 2008


Author: sunnavy
Date: Mon Apr 28 22:08:29 2008
New Revision: 11945

Modified:
   rt/branches/3.8-TESTING/lib/RT.pm.in
   rt/branches/3.8-TESTING/sbin/rt-setup-database.in

Log:
File::Spec has file_name_is_absolute method

Modified: rt/branches/3.8-TESTING/lib/RT.pm.in
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT.pm.in	(original)
+++ rt/branches/3.8-TESTING/lib/RT.pm.in	Mon Apr 28 22:08:29 2008
@@ -88,8 +88,7 @@
 # via the web interface)
 our $MasonSessionDir = '@MASON_SESSION_PATH@';
 
-# XXX TODO is there a better way to detect if path is relative or not?
-unless ( $EtcPath && $EtcPath =~ m{^/} ) {
+unless ( File::Spec->file_name_is_absolute($EtcPath) ) {
     my $pm_path = ( File::Spec->splitpath( $INC{'RT.pm'} ) )[1];
 
     # need rel2abs here is to make sure path is absolute, since $INC{'RT.pm'}

Modified: rt/branches/3.8-TESTING/sbin/rt-setup-database.in
==============================================================================
--- rt/branches/3.8-TESTING/sbin/rt-setup-database.in	(original)
+++ rt/branches/3.8-TESTING/sbin/rt-setup-database.in	Mon Apr 28 22:08:29 2008
@@ -54,9 +54,10 @@
 # we need to chdir first because maybe @LOCAL_LIB_PATH@ and @RT_LIB_PATH@ are
 # relative paths, and we mostly run this script in source dir instead of
 # installed dir
-
+use File::Spec;
 BEGIN {
-    chdir "@RT_PATH@" if -e "@RT_PATH@" && "@RT_LIB_PATH@" !~ m{^/};
+    chdir "@RT_PATH@"
+      if -e "@RT_PATH@" && !File::Spec->file_name_is_absolute("@RT_LIB_PATH@");
 }
 
 use lib "@LOCAL_LIB_PATH@";


More information about the Rt-commit mailing list