make unexpand not replace $PWD if $PWD == $HOME

This commit is contained in:
Lilian Jónsdóttir 2024-06-19 17:13:46 -07:00
parent 00b5808b1a
commit 75b6c1152a

View file

@ -19,8 +19,8 @@ func UnExpand(dir string) (outdir string) {
outdir = filepath.Clean(dir) outdir = filepath.Clean(dir)
pwd, err = os.Getwd() pwd, err = os.Getwd()
if err == nil { if err == nil && home != pwd {
outdir = strings.Replace(outdir, pwd, ".", 1) outdir = strings.Replace(outdir, pwd, "$PWD", 1)
} }
outdir = strings.Replace(outdir, home, "~", 1) outdir = strings.Replace(outdir, home, "~", 1)