From: Chris Waldon Date: Sun, 29 Nov 2020 23:58:29 +0000 (+0000) Subject: os: return proper user directories on iOS X-Git-Tag: go1.16beta1~146 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c193279e2c9e62e8ddc0893484251b4411461d62;p=gostls13.git os: return proper user directories on iOS Separating iOS into its own runtime constant broke the logic here to derive the correct home, cache, and config directories on iOS devices. Fixes #42878 Change-Id: Ie4ff57895fcc34b0a9af45554ea3a346447d2e7a GitHub-Last-Rev: 5e74e64917fa46e9c6e0d963cab5194ab89e2f64 GitHub-Pull-Request: golang/go#42879 Reviewed-on: https://go-review.googlesource.com/c/go/+/273947 Reviewed-by: Cherry Zhang Trust: Emmanuel Odeke --- diff --git a/src/os/file.go b/src/os/file.go index 835d44ab8c..420e62ef2c 100644 --- a/src/os/file.go +++ b/src/os/file.go @@ -406,7 +406,7 @@ func UserCacheDir() (string, error) { return "", errors.New("%LocalAppData% is not defined") } - case "darwin": + case "darwin", "ios": dir = Getenv("HOME") if dir == "" { return "", errors.New("$HOME is not defined") @@ -457,7 +457,7 @@ func UserConfigDir() (string, error) { return "", errors.New("%AppData% is not defined") } - case "darwin": + case "darwin", "ios": dir = Getenv("HOME") if dir == "" { return "", errors.New("$HOME is not defined") @@ -505,10 +505,8 @@ func UserHomeDir() (string, error) { switch runtime.GOOS { case "android": return "/sdcard", nil - case "darwin": - if runtime.GOARCH == "arm64" { - return "/", nil - } + case "ios": + return "/", nil } return "", errors.New(enverr + " is not defined") }