From 4a4951acd2169e97949d35b55dac47eaf776cda5 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Fri, 25 Sep 2020 14:53:03 -0300 Subject: win32: generate proper temp filename Closes #1224. See https://github.com/luarocks/luarocks/pull/1224/files#r493011698 Co-authored-by: dwenegar --- src/luarocks/fs/win32.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua index f544393d..8ae62cf0 100644 --- a/src/luarocks/fs/win32.lua +++ b/src/luarocks/fs/win32.lua @@ -336,7 +336,12 @@ function win32.make_temp_dir(name_pattern) end function win32.tmpname() - return os.getenv("TMP")..os.tmpname() + local name = os.tmpname() + local tmp = os.getenv("TMP") + if tmp and name:sub(1, #tmp) ~= tmp then + name = (tmp .. "\\" .. name):gsub("\\+", "\\") + end + return name end function win32.current_user() -- cgit v1.2.3-55-g6feb