summaryrefslogtreecommitdiff
path: root/xmake/core/base/os.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/base/os.lua')
-rw-r--r--xmake/core/base/os.lua17
1 files changed, 13 insertions, 4 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index d20cd671a..d50ce19f2 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -768,15 +768,24 @@ function os.tmpdir(opt)
-- get root tmpdir
local tmpdir_root = nil
if opt and opt.ramdisk == false then
+ tmpdir_root = os._ROOT_TMPDIR
if os._ROOT_TMPDIR == nil then
- os._ROOT_TMPDIR = (os.getenv("XMAKE_TMPDIR") or os.getenv("TMPDIR") or os._tmpdir()):trim()
+ tmpdir_root = (os.getenv("XMAKE_TMPDIR") or os.getenv("TMPDIR") or os._tmpdir()):trim()
+ -- TODO
+ if os.islink(tmpdir_root) then
+ tmpdir_root = os.readlink(tmpdir_root) or tmpdir_root
+ end
+ os._ROOT_TMPDIR = tmpdir_root
end
- tmpdir_root = os._ROOT_TMPDIR
else
+ tmpdir_root = os._ROOT_TMPDIR_RAM
if os._ROOT_TMPDIR_RAM == nil then
- os._ROOT_TMPDIR_RAM = (os.getenv("XMAKE_TMPDIR") or os._ramdir() or os.getenv("TMPDIR") or os._tmpdir()):trim()
+ tmpdir_root = (os.getenv("XMAKE_TMPDIR") or os._ramdir() or os.getenv("TMPDIR") or os._tmpdir()):trim()
+ if os.islink(tmpdir_root) then
+ tmpdir_root = os.readlink(tmpdir_root) or tmpdir_root
+ end
+ os._ROOT_TMPDIR_RAM = tmpdir_root
end
- tmpdir_root = os._ROOT_TMPDIR_RAM
end
-- make sub-directory name