summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/core/base/os.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index 7e6facc69..9f1f7fb85 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -570,7 +570,18 @@ function os.tmpdir(opt)
end
-- generate the temporary file path
-function os.tmpfile(key, opt)
+--
+-- e.g.
+-- os.tmpfile("key")
+-- os.tmpfile({key = "xxx", ramdisk = false})
+--
+function os.tmpfile(opt_or_key)
+ local opt
+ local key = opt_or_key
+ if type(key) == "table" then
+ key = opt_or_key.key
+ opt = opt_or_key
+ end
return path.join(os.tmpdir(opt), "_" .. (hash.uuid4(key):gsub("-", "")))
end