From 41bac185256efec90f7b11883df61bb70aac0453 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Tue, 8 Oct 2024 14:09:37 +0200 Subject: [PATCH] Replace ~ only if the path begins with ~ --- util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.go b/util.go index 3d210cb..b040c6f 100644 --- a/util.go +++ b/util.go @@ -62,7 +62,7 @@ func AreSame(lhs string, rhs string) bool { } func ConvertHome(input string) (string, error) { - if strings.Contains(input, "~") { + if strings.HasPrefix(input, "~/") { homedir, err := os.UserHomeDir() if err != nil { return input, fmt.Errorf("unable to convert ~ to user directory with error %+v", err)