diff options
-rwxr-xr-x | dwim | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -137,8 +137,10 @@ sub path { my $n = shift; $n =~ s,^~([^/]+),/home/$1,; $n =~ s,^~,/home/$ENV{USER},; - return $n if $n =~ /^\// or $n =~ /^~/; - return dir . "/$n"; + goto done if $n =~ /^\// or $n =~ /^~/; + $n = dir . "/$n"; +done: chdir dirname($n); + return $n; } # take K => V and return environment variable K if defined, otherwise V |