Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Only lookup / once
  • Loading branch information
lizmat committed Jul 8, 2014
1 parent 3397a71 commit 9013d8f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/CompUnitRepo/Local/File.pm
Expand Up @@ -8,6 +8,7 @@ class CompUnitRepo::Local::File does CompUnitRepo::Locally {
NQP => [$precomp,'nqp'],
JVM => [$precomp];
my $anyextensions = any($precomp,<pm6 pm5 pm nqp>);
my $slash := IO::Spec.rootdir;

method install($source, $from?) { ... }
method files($file, :$name, :$auth, :$ver) { ... }
Expand Down Expand Up @@ -38,15 +39,15 @@ class CompUnitRepo::Local::File does CompUnitRepo::Locally {
for $!path.contents -> $path {
my $file = ~$path;

# We loop over one element to be able to 'last' out ot if.
# We loop over one element to be able to 'last' out of if.
for $file.rindex(".") -> $i {
last unless $i.defined; # could not find any ext

my $ext = $file.substr($i + 1);
last unless $ext ~~ $anyextensions; # not right ext

my $root = $file.substr(0,$i);
my $j := $root.rindex(IO::Spec.rootdir);
my $j := $root.rindex($slash);
$root = $root.substr($j + 1) if $j.defined;

$potentials{$root}{$ext} := \($file, :name($root) );
Expand Down

0 comments on commit 9013d8f

Please sign in to comment.