Skip to content

Commit

Permalink
Fix home dir for windows
Browse files Browse the repository at this point in the history
Apparently the home path might very well be on a network drive, like H:\ which is a pain if
the user disconnects. Default to the user profile first, then only fall back to home if that's missing.
  • Loading branch information
kytrinyx committed Sep 28, 2014
1 parent 8bd1a25 commit 4ca3e97
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ type Config struct {
func Home() (string, error) {
var dir string
if runtime.GOOS == "windows" {
dir = os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
dir = os.Getenv("USERPROFILE")
if dir == "" {
dir = os.Getenv("USERPROFILE")
dir = os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
}
} else {
dir = os.Getenv("HOME")
Expand Down

0 comments on commit 4ca3e97

Please sign in to comment.