Skip to content
This repository has been archived by the owner on Feb 27, 2018. It is now read-only.

Commit

Permalink
Merge pull request #355 from ahmetalpbalkan/homedir
Browse files Browse the repository at this point in the history
Correct way to find home directory on windows
  • Loading branch information
gmlewis committed Mar 25, 2015
2 parents 8c5bc75 + 9b7526c commit ad28233
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ var (

func homeDir() (string, error) {
dir := ""

// *nix and MSYS Windows
if dir = os.Getenv("HOME"); dir == "" {
// Windows (if not running under MSYS)
if runtime.GOOS == "windows" {
dir = os.Getenv("USERPROFILE")
} else {
dir = os.Getenv("HOME")
}
if _, err := os.Stat(dir); err != nil {
return "", err
Expand Down

0 comments on commit ad28233

Please sign in to comment.