Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

[src/core/IO.pm] nicer &dir #72

Closed
wants to merge 2 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+1 −1
Split
View
@@ -316,7 +316,7 @@ sub dir($path = '.', Mu :$test = none('.', '..')) {
my @res;
loop (my int $i = 0; $i < $elems; $i = $i + 1) {
my Str $file := nqp::p6box_s(nqp::atpos($RSA, $i));
- @res.push: "$path/$file".IO if $test.ACCEPTS($file);
+ @res.push: ($path.substr(*-1) eq '/' ?? "$path$file" !! "$path/$file").IO if $test.ACCEPTS($file);
@ajs

ajs Jun 24, 2012

What w really need, here, is a File::Path module, but this change is a reasonable fix for the immediate problem.

}
return @res;