Skip to content

Commit

Permalink
fix: wrong user home dir with sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Joedt committed Nov 10, 2023
1 parent 2cf95b8 commit 181d9b3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions internal/grip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 181d9b3

Please sign in to comment.