]> Cypherpunks repositories - gostls13.git/commit
os: only fallback to root directory if $HOME fails for UserHomeDir
authorElias Naur <mail@eliasnaur.com>
Sun, 17 Mar 2019 15:01:27 +0000 (16:01 +0100)
committerElias Naur <mail@eliasnaur.com>
Sun, 17 Mar 2019 19:13:01 +0000 (19:13 +0000)
commitbedb6a18d855d1968a685ccd90c81a43b3def9fa
tree0c1ce671a93d5c3ab473e105893c354d257030e1
parenta734601bdf8a3e26c76afc42ffdc918ced687b7a
os: only fallback to root directory if $HOME fails for UserHomeDir

UserHomeDir always returns "/" for platforms where the home directory
is not always well defined. However, the user might set HOME before
running a Go program on those platforms and on at least iOS, HOME
is actually set to something useful (the root of the app specific
writable directory).

This CL changes UserHomeDir to use the root directory "/" only if
$HOME is empty.

Change-Id: Icaa01de53cd585d527d9a23b1629375d6b7f67e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/167802
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
src/os/file.go