aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarstr\xf6m <john@ankarstrom.se>2021-06-06 11:09:52 +0200
committerJohn Ankarstr\xf6m <john@ankarstrom.se>2021-06-06 11:09:52 +0200
commit81b3c2ae00ff63321e3e313ce09ae18b005e3874 (patch)
tree1f863ef29fd6b5b2f0b39f080d6addf1bb1d2d45
parent29fdf68905dc8cbfc4f18e0cf508117a5839d2dc (diff)
downloaddwim-81b3c2ae00ff63321e3e313ce09ae18b005e3874.tar.gz
Support ~home directories
-rwxr-xr-xdwim3
1 files changed, 3 insertions, 0 deletions
diff --git a/dwim b/dwim
index a536abb..d5c8646 100755
--- a/dwim
+++ b/dwim
@@ -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";