Skip to content

Commit d727abf

Browse files
committed
Updated M helper function in unzip to more reliably create directories on DOS and Windows.
1 parent 7f772a3 commit d727abf

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

arch/UNZIP.LUA

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ function unzip(z, d, l, x)
8484

8585
-- e = path seperator
8686
-- c = current path
87-
local e, c, t = package.config:sub(1, 1), "", {}
87+
local e, c, t = os.getenv("COMSPEC") and "\\" or "/", "", {}
8888

8989
p = p:gsub("[\\/]", e) -- Normalize separators to the current OS
9090
for i in p:gmatch("[^" .. e .. "]+") do table.insert(t, i) end
9191

9292
-- i = directory
9393
for i = 1, #t - 1 do
9494
c = c == "" and t[i] or c .. e .. t[i]
95-
os.execute('mkdir "' .. c .. '" ' .. (e == "\\" and '>nul 2>nul' or '>/dev/null 2>&1'))
95+
os.execute('mkdir "' .. c .. '" ' .. (e == "/" and '>/dev/null 2>&1' or '>nul'))
9696
end
9797
end
9898

0 commit comments

Comments
 (0)