From 75b6c1152a280e3dd7dd92eac75eed8335eab195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Wed, 19 Jun 2024 17:13:46 -0700 Subject: [PATCH] make unexpand not replace $PWD if $PWD == $HOME --- internal/dirs/dirs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/dirs/dirs.go b/internal/dirs/dirs.go index c43a61f..1ec4103 100644 --- a/internal/dirs/dirs.go +++ b/internal/dirs/dirs.go @@ -19,8 +19,8 @@ func UnExpand(dir string) (outdir string) { outdir = filepath.Clean(dir) pwd, err = os.Getwd() - if err == nil { - outdir = strings.Replace(outdir, pwd, ".", 1) + if err == nil && home != pwd { + outdir = strings.Replace(outdir, pwd, "$PWD", 1) } outdir = strings.Replace(outdir, home, "~", 1)