From 181d9b3245ae6f49d80d8c68681151967a80794e Mon Sep 17 00:00:00 2001 From: Alex Joedt Date: Fri, 10 Nov 2023 12:41:59 +0100 Subject: [PATCH] fix: wrong user home dir with sudo --- internal/grip.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/grip.go b/internal/grip.go index 7c599aa..de024f7 100644 --- a/internal/grip.go +++ b/internal/grip.go @@ -72,10 +72,9 @@ func init() { HomePath = filepath.Join(home, ".grip") - // TODO: test on mac sudoUser := os.Getenv("SUDO_USER") - if sudoUser != "" { - HomePath = strings.Replace(HomePath, "root", sudoUser, -1) + if sudoUser != "" && currentOS == "linux" { + HomePath = filepath.Join("/home", sudoUser, ".grip") } // TODO: read install path from config if config file exists