Skip to content

Commit

Permalink
Make dir return IO::Path objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
colomon committed Jun 3, 2013
1 parent 1bed6b7 commit 6e28e36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/CORE.setting
Expand Up @@ -3744,7 +3744,9 @@ sub slurp($path?) is unsafe {
sub spurt($path,$text) is unsafe { Q:CgOp { (rnull (spurt (unbox str (@ {$path.Str})) (unbox str (@ {$text.Str})))) } }
sub dir($directory = '.', Mu :$test = none('.','..')) is unsafe {
Q:CgOp { (dir (obj_getstr {$directory})) }.grep($test).map(*.path);
Q:CgOp { (dir (obj_getstr {$directory})) }.grep($test).map({
IO::Path.new(:$directory, :basename($_), :volume(""))
});
}
my class Instant {
Expand Down Expand Up @@ -3862,7 +3864,7 @@ class IO::Path is Cool does IO::FileTestable {
# react weirdly to '/'
if $path eq '/' {
self.bless(*, :basename(""),
:directory("/"),
:directory($path),
:volume(""));
} else {
self.bless(*, :basename(Q:CgOp { (box Str (path_get_file_name (obj_getstr {$path}))) }),
Expand Down
1 change: 1 addition & 0 deletions t/spectest.data
Expand Up @@ -499,6 +499,7 @@ S32-hash/pairs.t
S32-hash/push.t
S32-hash/slice.t
S32-io/chdir.t
S32-io/dir.t
S32-io/file-tests.t
S32-io/io-path.t
S32-io/note.t
Expand Down

0 comments on commit 6e28e36

Please sign in to comment.