1
0
mirror of https://github.com/golang/go synced 2024-11-26 15:46:54 -07:00

os: return proper User*Dir directories for GOOS=ios

This change adds GOOS=ios to the various User*Dir logic. It is
necessary because after #38485 was implemented, we isolated
GOOS=ios from GOOS=darwin and forgot to carry over the logic too,
to derive the appropriate home, cache and config directories on
iOS devices.

Updates #38485
Fixes #42878
This commit is contained in:
Chris Waldon 2020-11-29 17:29:22 -05:00
parent 926994fd7c
commit 5e74e64917
No known key found for this signature in database
GPG Key ID: 35BBC7C073F5A5D3

View File

@ -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")
}