support for android via termux
I have no idea if it's possible (or even worth it) to get go running in the adb shell android has no /tmp so I wouldn't know where to store files outside of termux
This commit is contained in:
parent
eefc0340db
commit
d1f173cab3
12
pkg/env/env.go
vendored
12
pkg/env/env.go
vendored
|
@ -78,16 +78,24 @@ func GetDataDir(appname string) string {
|
||||||
//
|
//
|
||||||
// returns %TEMP% on Windows, /tmp on UNIX-like systems
|
// returns %TEMP% on Windows, /tmp on UNIX-like systems
|
||||||
func GetTempDirectory() string {
|
func GetTempDirectory() string {
|
||||||
|
var tmp string
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "windows":
|
case "windows":
|
||||||
return os.Getenv("TEMP")
|
tmp = os.Getenv("TEMP")
|
||||||
|
case "android":
|
||||||
|
if t := os.Getenv("TMPDIR"); t != "" {
|
||||||
|
tmp = t
|
||||||
|
} else if t = os.Getenv("PREFIX"); t != "" {
|
||||||
|
tmp = t + "/tmp"
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
fallthrough
|
fallthrough
|
||||||
case "darwin":
|
case "darwin":
|
||||||
fallthrough
|
fallthrough
|
||||||
case "linux":
|
case "linux":
|
||||||
return "/tmp"
|
tmp = "/tmp"
|
||||||
}
|
}
|
||||||
|
return tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
func make_path(paths ...string) string {
|
func make_path(paths ...string) string {
|
||||||
|
|
Loading…
Reference in a new issue