[Rt-commit] r11911 - rt/branches/3.8-TESTING/lib
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Mon Apr 28 05:32:13 EDT 2008
Author: sunnavy
Date: Mon Apr 28 05:32:11 2008
New Revision: 11911
Modified:
rt/branches/3.8-TESTING/lib/RT.pm.in
Log:
handle relative paths in RT.pm
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 05:32:11 2008
@@ -88,6 +88,23 @@
# 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 ( $BasePath && $BasePath =~ m{^/} ) {
+ my $pm_path = ( File::Spec->splitpath( $INC{'RT.pm'} ) )[1];
+
+ # need rel2abs here is to make sure path is absolute, since $INC{'RT.pm'}
+ # is not always absolute
+ $BasePath =
+ File::Spec->rel2abs( File::Spec->catfile( $pm_path, File::Spec->updir ) );
+
+ for my $path ( qw/EtcPath BinPath VarPath LocalPath LocalEtcPath
+ LocalLibPath LocalLexiconPath LocalPluginPath MasonComponentRoot
+ MasonLocalComponentRoot MasonDataDir MasonSessionDir/ ) {
+ no strict 'refs';
+ $$path = File::Spec->catfile( $BasePath, $$path )
+ unless $$path =~ m{^/}; # just change relative ones
+ }
+}
=head1 NAME
More information about the Rt-commit
mailing list