diff --git a/lib/WebGUI/Paths.pm b/lib/WebGUI/Paths.pm index bb50afe0f..51281695d 100644 --- a/lib/WebGUI/Paths.pm +++ b/lib/WebGUI/Paths.pm @@ -103,13 +103,15 @@ sub preloadPaths { my $class = shift; my @paths; try { - @paths = grep { - (-d) ? 1 : do { - warn "WARNING: Not adding lib directory '$_' from " - . $class->preloadCustom . ": Directory does not exist.\n"; - 0; + for my $path ( _readTextLines($class->preloadCustom) ) { + if (-d $path) { + push @paths, $path; } - } _readTextLines($class->preloadCustom); + else { + warn "WARNING: Not adding lib directory '$path' from " + . $class->preloadCustom . ": Directory does not exist.\n"; + } + } }; return @paths; } diff --git a/t/Paths.t b/t/Paths.t index e4e181dc2..323ebe95c 100644 --- a/t/Paths.t +++ b/t/Paths.t @@ -2,10 +2,10 @@ use 5.010; use strict; use warnings; -use Test::More tests => 3; +use Test::More; use WebGUI::Paths; -can_ok 'WebGUI::Paths', qw( +my @pathMethods = qw( configBase logConfig spectreConfig @@ -17,6 +17,8 @@ can_ok 'WebGUI::Paths', qw( defaultCreateSQL var ); +can_ok 'WebGUI::Paths', @pathMethods; + ok !(grep { WebGUI::Paths->can($_) } qw( croak realpath @@ -35,3 +37,10 @@ ok !(grep { WebGUI::Paths->can($_) } qw( my @configs = WebGUI::Paths->siteConfigs; ok !(\@configs ~~ WebGUI::Paths->spectreConfig), 'Spectre config not listed in configs'; +for my $method (@pathMethods) { + my $return = WebGUI::Paths->$method; + ok $return, "$method returns a path"; +} + +done_testing; +