From bc2a5b75bc203fc30c31cf8ac3caceba6a8fd041 Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sat, 3 Dec 2022 16:21:18 -0500 Subject: Unified windows and linux behavior. --- src/lpm.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/lpm.lua') diff --git a/src/lpm.lua b/src/lpm.lua index 992ab9f..28f866b 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -391,7 +391,12 @@ function common.rmrf(root) if not info then return end if info.type == "file" or info.symlink then local status, err = os.remove(root) - if not status then error("can't remove " .. root .. ": " .. err) end + if not status then + if not err:find("permission") then error("can't remove " .. root .. ": " .. err) end + system.chmod(root, 844) -- chmod so that we can write, for windows. + status, err = os.remove(root) + if not status then error("can't remove " .. root .. ": " .. err) end + end else for i,v in ipairs(system.ls(root)) do common.rmrf(root .. PATHSEP .. v) end system.rmdir(root) -- cgit v1.2.3