@candidates = $name;
} else {
(my $base, @args) = split ' ', $name;
- @candidates = map File::Spec->catfile($_, $base), File::Spec->path;
+ for my $path_entry (File::Spec->path) {
+ my ($vol, $dir, $file) = File::Spec->splitpath($path_entry, 1);
+ next if defined $file and length $file;
+ push @candidates, File::Spec->catpath($vol, $dir, $base);
+ }
}
for my $path (@candidates) {