From eabffb0342fd37502e66a65cc857ec0ac986c9d0 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Tue, 10 Jul 2007 21:25:54 +0000 Subject: [PATCH] fix: Error with new 7.4 preload.custom. Added better sanity checking with messages. --- sbin/preload.perl | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/sbin/preload.perl b/sbin/preload.perl index bddc64e7a..26e93f84a 100644 --- a/sbin/preload.perl +++ b/sbin/preload.perl @@ -2,19 +2,23 @@ my $webguiRoot; my $customLibs; BEGIN { - $webguiRoot = "/data/WebGUI"; - unshift (@INC, $webguiRoot."/lib"); - @{$customLibs} = (); - open(FILE,"<".$webguiRoot."/sbin/preload.custom"); - while (my $line = ) { - next if $line =~ m/^#/; - chomp $line; - push(@{$customLibs}, $line); - } - close(FILE); - foreach my $lib (@customLibs) { - unshift (@INC, $lib); + $webguiRoot = "/data/WebGUI"; + unshift (@INC, $webguiRoot."/lib"); + @{$customLibs} = (); + open(FILE,"<".$webguiRoot."/sbin/preload.custom"); + while (my $line = ) { + chomp $line; + next unless $line; + if (!-d $line) { + print "WARNING: Not adding lib directory '$line' from $webguiRoot/sbin/preload.custom: Directory does not exist.\n"; + next; } + push(@{$customLibs}, $line); + } + close(FILE); + foreach my $lib (@{$customLibs}) { + unshift @INC, $lib; + } } $|=1;