File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ package settings
2020
2121import (
2222 "fmt"
23- "os/user "
23+ "os"
2424 "runtime"
2525)
2626
@@ -48,13 +48,19 @@ func getDefaultInstallDir() string {
4848 return "/Applications"
4949 case Windows :
5050 // https://superuser.com/questions/1327037/what-choices-do-i-have-about-where-to-install-software-on-windows-10
51- usr , _ := user .Current () // safe to ignore cache errors
52- return fmt .Sprintf (`%s\AppData\Local\Programs` , usr .HomeDir )
51+ homeDir , err := os .UserHomeDir ()
52+ if err != nil {
53+ return ""
54+ }
55+ return fmt .Sprintf (`%s\AppData\Local\Programs` , homeDir )
5356 case Linux :
5457 // https://unix.stackexchange.com/questions/127076/into-which-directory-should-i-install-programs-in-linux
55- usr , _ := user .Current () // safe to ignore cache errors
5658 // Use path in users home folder to not require sudo permissions for installation
57- return fmt .Sprintf (`%s/.local/bin` , usr .HomeDir )
59+ homeDir , err := os .UserHomeDir ()
60+ if err != nil {
61+ return ""
62+ }
63+ return fmt .Sprintf (`%s/.local/bin` , homeDir )
5864 default :
5965 return ""
6066 }
You can’t perform that action at this time.
0 commit comments