]> Cypherpunks repositories - gostls13.git/commitdiff
os: change UserHomeDir to use USERPROFILE on windows
authorJordan Rhee <jordanrh@microsoft.com>
Wed, 17 Oct 2018 16:41:09 +0000 (09:41 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 17 Oct 2018 19:39:40 +0000 (19:39 +0000)
Fixes #28182

Change-Id: I49c2117fba6325c234512f937ff2edfa9477f52f
Reviewed-on: https://go-review.googlesource.com/c/142886
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/os/file.go

index 3e626a023aa48d17a45f629ee9359a50dee6bad6..d9c5c57c17354cc5cfd37f543732998725098fc1 100644 (file)
@@ -384,12 +384,12 @@ func UserCacheDir() (string, error) {
 // UserHomeDir returns the current user's home directory.
 //
 // On Unix, including macOS, it returns the $HOME environment variable.
-// On Windows, it returns the concatenation of %HOMEDRIVE% and %HOMEPATH%.
+// On Windows, it returns %USERPROFILE%.
 // On Plan 9, it returns the $home environment variable.
 func UserHomeDir() string {
        switch runtime.GOOS {
        case "windows":
-               return Getenv("HOMEDRIVE") + Getenv("HOMEPATH")
+               return Getenv("USERPROFILE")
        case "plan9":
                return Getenv("home")
        case "nacl", "android":