Skip to content
Browse files

Merge branch 'master' into pod-installing

  • Loading branch information...
2 parents 551cdc5 + b78a5a0 commit 395943c9f18eea9ab6d592d3cca0278c1e9ccfc2 @tadzik committed Jun 23, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 ext/File/Find.pm
View
8 ext/File/Find.pm
@@ -44,17 +44,21 @@ sub checkrules ($elem, %opts) {
return True
}
+sub file-from-path($path) {
+ $path.split('/')[*-1];
+}
+
sub find (:$dir!, :$name, :$type) is export {
my @targets = dir($dir).map: {
- File::Find::Result.new(dir => $dir, name => $_);
+ File::Find::Result.new(dir => $dir, name => file-from-path(.path));
};
my $list = gather while @targets {
my $elem = @targets.shift;
take $elem if checkrules($elem, { :$name, :$type });
if $elem.IO ~~ :d {
for dir($elem) -> $file {
@targets.push(
- File::Find::Result.new(dir => $elem, name => $file)
+ File::Find::Result.new(dir => $elem, name => file-from-path($file.path))
);
}
}

0 comments on commit 395943c

Please sign in to comment.
Something went wrong with that request. Please try again.