Commit 5ddec248 authored by Jordan Rhee's avatar Jordan Rhee Committed by Brad Fitzpatrick

os: change UserHomeDir to use USERPROFILE on windows

Fixes #28182

Change-Id: I49c2117fba6325c234512f937ff2edfa9477f52f
Reviewed-on: https://go-review.googlesource.com/c/142886Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 51857449
...@@ -384,12 +384,12 @@ func UserCacheDir() (string, error) { ...@@ -384,12 +384,12 @@ func UserCacheDir() (string, error) {
// UserHomeDir returns the current user's home directory. // UserHomeDir returns the current user's home directory.
// //
// On Unix, including macOS, it returns the $HOME environment variable. // 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. // On Plan 9, it returns the $home environment variable.
func UserHomeDir() string { func UserHomeDir() string {
switch runtime.GOOS { switch runtime.GOOS {
case "windows": case "windows":
return Getenv("HOMEDRIVE") + Getenv("HOMEPATH") return Getenv("USERPROFILE")
case "plan9": case "plan9":
return Getenv("home") return Getenv("home")
case "nacl", "android": case "nacl", "android":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment