Skip to content

Commit c193279

Browse files
whereswaldoncherrymui
authored andcommitted
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: 5e74e64 GitHub-Pull-Request: #42879 Reviewed-on: https://go-review.googlesource.com/c/go/+/273947 Reviewed-by: Cherry Zhang <cherryyz@google.com> Trust: Emmanuel Odeke <emmanuel@orijtech.com>
1 parent 294c214 commit c193279

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/os/file.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ func UserCacheDir() (string, error) {
406406
return "", errors.New("%LocalAppData% is not defined")
407407
}
408408

409-
case "darwin":
409+
case "darwin", "ios":
410410
dir = Getenv("HOME")
411411
if dir == "" {
412412
return "", errors.New("$HOME is not defined")
@@ -457,7 +457,7 @@ func UserConfigDir() (string, error) {
457457
return "", errors.New("%AppData% is not defined")
458458
}
459459

460-
case "darwin":
460+
case "darwin", "ios":
461461
dir = Getenv("HOME")
462462
if dir == "" {
463463
return "", errors.New("$HOME is not defined")
@@ -505,10 +505,8 @@ func UserHomeDir() (string, error) {
505505
switch runtime.GOOS {
506506
case "android":
507507
return "/sdcard", nil
508-
case "darwin":
509-
if runtime.GOARCH == "arm64" {
510-
return "/", nil
511-
}
508+
case "ios":
509+
return "/", nil
512510
}
513511
return "", errors.New(enverr + " is not defined")
514512
}

0 commit comments

Comments
 (0)