diff options
| author | ruki <[email protected]> | 2020-03-22 11:45:56 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-03-22 11:45:56 +0800 |
| commit | 87f90a76e64af696a837d5708383af64d1d9b4a4 (patch) | |
| tree | c96569f62bc5af5b638f800ae4cfe42bdfc7ddf0 | |
| parent | bec614f796fb02238f7010c7bd68f71730fa280d (diff) | |
fix tmpfile
| -rw-r--r-- | xmake/core/base/os.lua | 13 |
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 |
