From 87f90a76e64af696a837d5708383af64d1d9b4a4 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 22 Mar 2020 11:45:56 +0800 Subject: fix tmpfile --- xmake/core/base/os.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 -- cgit v1.3.1