if ((-d "$curdir/$l") && $p eq substr($l, 0, length $p)) {
dbg("got dir: $curdir/$l\n") if isdbg('command');
$dirfn .= "$l/";
$curdir .= "/$l";
if ((-d "$curdir/$l") && $p eq substr($l, 0, length $p)) {
dbg("got dir: $curdir/$l\n") if isdbg('command');
$dirfn .= "$l/";
$curdir .= "/$l";
- } else { # we are dealing with commands
- @lparts = split /\./, $l;
- next if $lparts[$#lparts] ne $suffix; # only look for .$suffix files
+ }
+ # only proceed if we find the directory asked for
+ return () unless $found;
+ } else {
+ foreach my $l (sort @ls) {
+ next if $l =~ /^\./;
+ next unless $l =~ /\.$suffix$/;
$dirfn = "" unless $dirfn;
$cmd_cache{$short_cmd} = join(',', ($path, "$dirfn$l")); # cache it
dbg("got path: $path cmd: $dirfn$l\n") if isdbg('command');
$dirfn = "" unless $dirfn;
$cmd_cache{$short_cmd} = join(',', ($path, "$dirfn$l")); # cache it
dbg("got path: $path cmd: $dirfn$l\n") if isdbg('command');