don't replace workdir anymore

This commit is contained in:
Lilian Jónsdóttir 2024-07-15 15:58:57 -07:00
parent 1a9e64d473
commit 26f5f383ce
2 changed files with 6 additions and 8 deletions

View file

@ -11,14 +11,12 @@ import (
// $HOME -> ~
// $PWD -> .
// workdir -> .
func UnExpand(dir, workdir string) (outdir string) {
func UnExpand(dir string) (outdir string) {
outdir = filepath.Clean(dir)
home := os.Getenv("HOME")
if pwd, err := os.Getwd(); err == nil && home != pwd {
outdir = strings.Replace(outdir, pwd, ".", 1)
} else if workdir != "" {
outdir = strings.Replace(outdir, workdir, "", 1)
}
outdir = strings.Replace(outdir, home, "~", 1)