Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix dir() on jvm
  • Loading branch information
lizmat committed Oct 3, 2014
1 parent 16232fc commit f948d73
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/core/IO/Path.pm
Expand Up @@ -271,8 +271,10 @@ my class IO::Path is Cool does IO::FileTestable {
} }
my $cwd_chars = $CWD.chars;

#?if !jvm
my str $cwd = nqp::cwd();
nqp::chdir(nqp::unbox_s($.abspath));
#?endif

#?if parrot
my Mu $RSA := pir::new__PS('OS').readdir($!abspath);
Expand All @@ -291,7 +293,7 @@ my class IO::Path is Cool does IO::FileTestable {
#?endif
#?if !parrot

my Mu $dirh := nqp::opendir($!abspath);
my Mu $dirh := nqp::opendir(nqp::unbox_s($.abspath));
my $next = 1;
gather {
take $_.IO(:$!SPEC,:$*CWD) if $_ ~~ $test for ".", "..";
Expand All @@ -305,14 +307,19 @@ my class IO::Path is Cool does IO::FileTestable {
#?endif
#?if moar
$elem = $!SPEC.catfile($!abspath, $elem); # moar = relative
#?endif
#?if !parrot
$elem = nqp::substr($elem, $cwd_chars + 1) if !$absolute;
take $elem.IO(:$!SPEC,:$CWD) if $test.ACCEPTS($elem);
}
}
nqp::chdir($cwd);
}
#?endif
#?if jvm
$elem = nqp::substr($elem, $cwd_chars + 1) if !$absolute;
take $elem.IO(:$!SPEC,:$CWD) if $test.ACCEPTS($elem);
}
}
}
#?endif
}

Expand Down

0 comments on commit f948d73

Please sign in to comment.