os: fix tmpdir on unix

pull/3270/head
mY9Yd2 2019-12-30 05:25:26 +01:00 committed by Alexander Medvednikov
parent 89d3075f88
commit 6cee50afda
1 changed files with 3 additions and 21 deletions

View File

@ -1073,27 +1073,6 @@ pub fn join(base string, dirs ...string) string {
// tmpdir returns the path to a folder, that is suitable for storing temporary files
pub fn tmpdir() string {
mut path := os.getenv('TMPDIR')
$if linux {
if path == '' {
path = '/tmp'
}
}
$if freebsd {
if path == '' {
path = '/tmp'
}
}
$if macos {
/*
if path == '' {
// TODO untested
path = C.NSTemporaryDirectory()
}
*/
if path == '' {
path = '/tmp'
}
}
$if windows {
if path == '' {
// TODO see Qt's implementation?
@ -1108,6 +1087,9 @@ pub fn tmpdir() string {
}
}
}
if path == '' {
path = '/tmp'
}
return path
}