From d07f647bd2c3d163a7227470dbcb9395d3f8b91c Mon Sep 17 00:00:00 2001 From: Martin Berends Date: Thu, 11 Mar 2010 19:25:41 +0000 Subject: [PATCH] [Perl6/Module/Locator.pm] insert a / between path and filename if the name occurs after a :: separator --- src/Perl6/Module/Locator.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Perl6/Module/Locator.pm b/src/Perl6/Module/Locator.pm index 42c1518f4f8..05789c23b72 100644 --- a/src/Perl6/Module/Locator.pm +++ b/src/Perl6/Module/Locator.pm @@ -4,19 +4,25 @@ class Perl6::Module::Locator; method find_candidates($lookfor, @inc) { + # convert $lookfor A::B::C into $localpath A/B/ and $file C my @dirs := pir::split__PSS('::', $lookfor); my $file := @dirs.pop(); my $localpath := +@dirs ?? pir::join__SSP('/', @dirs) ~ '/' !! ''; - + # pir::say("\nlookfor: $lookfor\nlocalpath: $localpath\nfile: $file"); + + # within each @inc path look for "$localpath/$file.pm" my @candidates; for @inc { - my $path := "$_$localpath"; + my $path := "$_/$localpath"; + # pir::say(" path: $path"); if pir::stat__ISI("$path", 0) && pir::stat__ISI($path, 2) { my @dir := pir::new__PS('OS').readdir($path); for @dir { + # pir::say(" readdir: $_"); if pir::substr__SSII($_, 0, pir::length__IS($file) + 1) eq $file ~ '.' && pir::substr__SSII($_, pir::length__IS($_) - 3, 3) eq '.pm' { - @candidates.push("$path/$_"); + @candidates.push("$path$_"); + # pir::say(" found: $path$_"); } } }