aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/mitchellh/go-homedir/homedir.go
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2018-08-23 22:51:21 +0100
committerNiall Sheridan <nsheridan@gmail.com>2018-08-24 13:45:03 +0100
commitf8e3dea19012ccf05965d10255789eec33c2ebcf (patch)
tree8522ceada8bc7270648f29615b89550db910cb6c /vendor/github.com/mitchellh/go-homedir/homedir.go
parent91f9bc722152146466523861162b85195f99875b (diff)
Update deps
Diffstat (limited to 'vendor/github.com/mitchellh/go-homedir/homedir.go')
-rw-r--r--vendor/github.com/mitchellh/go-homedir/homedir.go10
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 acbb605..fb87bef 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