diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2018-08-29 20:39:35 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2018-08-29 20:39:35 -0400 |
| commit | c685affef751c8f53026ec67d2ef947c46f66ada (patch) | |
| tree | 48b163e88b1e112a1d7b93b5b8088bea25ffb18e /vendor/github.com/mitchellh | |
| parent | 0977f31ee3085f9ea7b5628eb5a2bac91c6ec163 (diff) | |
Updating dependencies
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'vendor/github.com/mitchellh')
| -rw-r--r-- | vendor/github.com/mitchellh/go-homedir/homedir.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/vendor/github.com/mitchellh/go-homedir/homedir.go b/vendor/github.com/mitchellh/go-homedir/homedir.go index acbb605d..fb87bef9 100644 --- a/vendor/github.com/mitchellh/go-homedir/homedir.go +++ b/vendor/github.com/mitchellh/go-homedir/homedir.go @@ -141,14 +141,16 @@ func dirWindows() (string, error) { return home, nil } + // Prefer standard environment variable USERPROFILE + if home := os.Getenv("USERPROFILE"); home != "" { + return home, nil + } + drive := os.Getenv("HOMEDRIVE") path := os.Getenv("HOMEPATH") home := drive + path if drive == "" || path == "" { - home = os.Getenv("USERPROFILE") - } - if home == "" { - return "", errors.New("HOMEDRIVE, HOMEPATH, and USERPROFILE are blank") + return "", errors.New("HOMEDRIVE, HOMEPATH, or USERPROFILE are blank") } return home, nil |
