diff options
-rw-r--r-- | src/lpm.lua | 7 |
1 files changed, 6 insertions, 1 deletions
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) |