mirror of
https://github.com/golang/go
synced 2024-11-22 18:54:44 -07:00
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: 5e74e64917
GitHub-Pull-Request: golang/go#42879
Reviewed-on: https://go-review.googlesource.com/c/go/+/273947
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
This commit is contained in:
parent
294c214cca
commit
c193279e2c
@ -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")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user