summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-03-01 13:16:41 +0800
committerruki <[email protected]>2020-03-01 13:16:41 +0800
commite748a26424e7e8c5e8136afc5610643667cd587e (patch)
tree49ab7ee56fcb14cc5d7de55499d46c5ab3a2b073
parentce93139a61debcca7ca3f1878775f1385e78f53a (diff)
improve tmpdir
-rw-r--r--xmake/core/base/os.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index a947cfc3b..19c4fe8d2 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -555,12 +555,14 @@ function os.tmpdir(opt)
end
-- make sub-directory name
- local subdir = (os._FAKEROOT and ".xmakefake" or ".xmake") .. (os.uid().euid or "")
+ local subdir = os._TMPSUBDIR
+ if not subdir then
+ subdir = path.join((os._FAKEROOT and ".xmakefake" or ".xmake") .. (os.uid().euid or ""), os.date("%y%m%d"))
+ os._TMPSUBDIR = subdir
+ end
-- get a temporary directory for each user
- local tmpdir = path.join(tmpdir_root, subdir, os.date("%y%m%d"))
-
- -- ensure this directory exist and remove the previous directory
+ local tmpdir = path.join(tmpdir_root, subdir)
if not os.isdir(tmpdir) then
os.mkdir(tmpdir)
end