Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Some more obvious optimizations
  • Loading branch information
lizmat committed Sep 30, 2014
1 parent 70f4ff2 commit 3b9d0cd
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/core/IO/Spec/Win32.pm
Expand Up @@ -36,11 +36,9 @@ my class IO::Spec::Win32 is IO::Spec::Unix {
}

method path {
my @path = split(';', %*ENV<PATH> // %*ENV<Path> // '');
@path».=subst(:global, q/"/, '');
@path = grep *.chars, @path;
unshift @path, ".";
return @path;
(".",
split(';', %*ENV<PATH> // %*ENV<Path> // '').map( {
.subst(:global, q/"/, '') } ).grep: *.chars );
}

method is-absolute ($path) {
Expand Down Expand Up @@ -83,25 +81,18 @@ my class IO::Spec::Win32 is IO::Spec::Unix {

method splitpath($path as Str, :$nofile = False) {

my ($volume,$dirname,$file) = ('','','');
if ( $nofile ) {
$path ~~
/^ (<$volume_rx>?) (.*) /;
$volume = ~$0;
$dirname = ~$1;
if $nofile {
$path ~~ /^ (<$volume_rx>?) (.*) /;
(~$0, ~$1, '');
}
else {
$path ~~
m/^ ( <$volume_rx> ? )
( [ .* <$slash> [ '.' ** 1..2 $]? ]? )
(.*)
/;
$volume = ~$0;
$dirname = ~$1;
$file = ~$2;
(~$0, ~$1, ~$2);
}

return ($volume,$dirname,$file);
}

method catpath($volume is copy, $dirname, $file) {
Expand Down

0 comments on commit 3b9d0cd

Please sign in to comment.