1
0
mirror of https://github.com/golang/go synced 2024-11-17 00:14:50 -07:00

os: make UserHomeDir specialize behavior for GOOS=android

Change-Id: I69582662aeee7344226856c24907516ddfc92f60
Reviewed-on: https://go-review.googlesource.com/c/139717
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Elias Naur <elias.naur@gmail.com>
This commit is contained in:
Brad Fitzpatrick 2018-10-04 15:26:04 +00:00
parent 4c1c839a3d
commit f22c357a34

View File

@ -387,16 +387,16 @@ func UserCacheDir() (string, error) {
// On Windows, it returns the concatenation of %HOMEDRIVE% and %HOMEPATH%.
// On Plan 9, it returns the $home environment variable.
func UserHomeDir() string {
if runtime.GOOS == "windows" {
switch runtime.GOOS {
case "windows":
return Getenv("HOMEDRIVE") + Getenv("HOMEPATH")
}
if runtime.GOOS == "plan9" {
case "plan9":
return Getenv("home")
}
if runtime.GOOS == "nacl" {
case "nacl", "android":
return "/"
default:
return Getenv("HOME")
}
return Getenv("HOME")
}
// Chmod changes the mode of the named file to mode.