Skip to content

Commit

Permalink
[bin/ufo] chased Rakudo &dir API change
Browse files Browse the repository at this point in the history
A simplifying change to &dirwalk. &dir now dresses
up the path as an IO object.
  • Loading branch information
Carl Mäsak committed Jun 23, 2012
1 parent e889d21 commit a644578
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions bin/ufo
Expand Up @@ -158,16 +158,13 @@ sub find-file-by-ext(@dirs, *@ext) {
}

sub dirwalk(Str $dir = '.', Mu :$d = none(<. ..>), Mu :$f = *, :&dx = -> $ {}, :&fx = -> $ {}) {
for dir($dir, :test(*)) -> $p {
my $path = "$dir/$p";
given $path.IO {
when .f {
fx($path) if $path ~~ $f
}
when .d {
dirwalk(.path, :$d, :$f, :&dx, :&fx) if $p ~~ $d;
}
for dir($dir, :test(*)) {
when .f {
fx($path) if $path ~~ $f
}
when .d {
dirwalk(.path, :$d, :$f, :&dx, :&fx) if $p ~~ $d;
}
}
dx($dir) if $dir ~~ $d;
}
Expand Down

0 comments on commit a644578

Please sign in to comment.