Permalink
Browse files

simplify &dirwalk code after last rakudo &dir update

  • Loading branch information...
1 parent d3123ea commit 1593c6bd5a1ff21758d00360d9bef633fe2951d5 @moritz moritz committed Jun 29, 2012
Showing with 1 addition and 9 deletions.
  1. +1 −9 bin/ufo
View
10 bin/ufo
@@ -157,22 +157,14 @@ sub find-file-by-ext(@dirs, *@ext) {
}
}
-sub basename(Str $path) {
- my $slash = $path.rindex('/');
- if $slash {
- return $path.substr($slash + 1)
- }
- return $path
-}
-
sub dirwalk(Str $dir = '.', Mu :$d = none(<. ..>), Mu :$f = *, :&dx = -> $ {}, :&fx = -> $ {}) {
for dir($dir, :test(*)) -> $p {
when $p.f {
fx($p.path) if $p.path ~~ $f
}
when $p.d {
dirwalk($p.path, :$d, :$f, :&dx, :&fx)
- if basename($p.path) ~~ $d;
+ if $p.basename ~~ $d;
}
}
dx($dir) if $dir ~~ $d;

0 comments on commit 1593c6b

Please sign in to comment.