Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 2 commits into from
Closed

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

wants to merge 2 commits into from

Conversation

sergot
Copy link
Member

@sergot sergot commented Jun 24, 2012

No change 'inside', only 'outside'. Works the same way.
'/' is unnecessary in particular calls.

before:

.Str.say for dir './'
.//file2
.//file1
.//dir2
.//dir1

after:

.Str.say for dir './'
./file2
./file1
./dir2
./dir1

@@ -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);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@labster
Copy link
Member

labster commented May 31, 2013

Replaced by IO::Spec/IO::Path stuff, long after this pull request was sent. Closing ticket.

@labster labster closed this May 31, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants