From 9985d24ea239a9b560df1b75901f4c69941bde22 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 11 Jul 2011 15:09:21 -0700 Subject: [PATCH] make installClass read lines from preload.custom for additional directories. Fixes bug #12189 --- docs/changelog/7.x.x.txt | 1 + sbin/installClass.pl | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 5239aabee..377aa76d6 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -12,6 +12,7 @@ - fixed #12190: List type form plugins that do not override getOptions show no value when getValueAsHtml is called - fixed #12135: Geo::Coder::Googlev3 needs common sense - fixed #12183: Posts do not disqualify themselves when purged + - fixed #12189: installClass ignores preload.custom 7.10.19 - fixed #12169: extras uploads symlink export diff --git a/sbin/installClass.pl b/sbin/installClass.pl index 6d92cf058..5758d0d41 100755 --- a/sbin/installClass.pl +++ b/sbin/installClass.pl @@ -58,6 +58,15 @@ if( ! -e $configFile ) { die "Config file '$configFile' does not exist!\n" if ! -e $configFile; +foreach my $libDir ( readLines( "preload.custom" ) ) { + if ( !-d $libDir ) { + warn "WARNING: Not adding lib directory '$libDir' from preload.custom: Directory does not exist.\n"; + next; + } + unshift @INC, $libDir; +} + + # Open the session my $session = WebGUI::Session->open( $webguiRoot, $configFile ); $session->user( { userId => 3 } ); @@ -98,6 +107,24 @@ else { $session->var->end; $session->close; +#------------------------------------------------- +sub readLines { + my $file = shift; + my @lines; + if (open(my $fh, '<', $file)) { + while (my $line = <$fh>) { + $line =~ s/#.*//; + $line =~ s/^\s+//; + $line =~ s/\s+$//; + next if !$line; + push @lines, $line; + } + close $fh; + } + return @lines; +} + + __END__ =head1 NAME