1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: fix tmpdir on unix

This commit is contained in:
mY9Yd2 2019-12-30 05:25:26 +01:00 committed by Alexander Medvednikov
parent 89d3075f88
commit 6cee50afda

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 // tmpdir returns the path to a folder, that is suitable for storing temporary files
pub fn tmpdir() string { pub fn tmpdir() string {
mut path := os.getenv('TMPDIR') 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 windows {
if path == '' { if path == '' {
// TODO see Qt's implementation? // TODO see Qt's implementation?
@ -1108,6 +1087,9 @@ pub fn tmpdir() string {
} }
} }
} }
if path == '' {
path = '/tmp'
}
return path return path
} }