diff options
author | John Ankarstr\xf6m <john@ankarstrom.se> | 2021-06-06 11:09:52 +0200 |
---|---|---|
committer | John Ankarstr\xf6m <john@ankarstrom.se> | 2021-06-06 11:09:52 +0200 |
commit | 81b3c2ae00ff63321e3e313ce09ae18b005e3874 (patch) | |
tree | 1f863ef29fd6b5b2f0b39f080d6addf1bb1d2d45 | |
parent | 29fdf68905dc8cbfc4f18e0cf508117a5839d2dc (diff) | |
download | dwim-81b3c2ae00ff63321e3e313ce09ae18b005e3874.tar.gz |
Support ~home directories
-rwxr-xr-x | dwim | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -107,6 +107,9 @@ sub path { return $n if $n =~ /^\// or $n =~ /^~/; my $d = `xtitle`; chomp $d; + $d =~ s/.*\(([^(]+)\)$/$1/; + $d =~ s,^~([^/]+),/home/$1,; + $d =~ s,^~,/home/$ENV{USER},; die "couldn't retrieve current directory\n" if ! -d $d and ! -d ($d = dirname($d)); return "$d/$n"; |