mirror of
https://github.com/zenith391/OCEmu.git
synced 2025-09-27 23:13:56 -04:00
use lfs to rmdir instead of os.remove because windows is not posix compliant
This commit is contained in:
parent
f2aa100686
commit
1310d651e8
22
src/boot.lua
22
src/boot.lua
@ -49,6 +49,8 @@ local function boot()
|
||||
end
|
||||
end
|
||||
|
||||
local os_remove_leaf = os.remove
|
||||
|
||||
local recursiveDelete
|
||||
function recursiveDelete(path)
|
||||
local mode = lfs.attributes(path,"mode")
|
||||
@ -62,11 +64,11 @@ local function boot()
|
||||
if mode == "directory" then
|
||||
recursiveDelete(path .. "/" .. entry)
|
||||
end
|
||||
os.remove(path .. "/" .. entry)
|
||||
os_remove_leaf(path .. "/" .. entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
return os.remove(path)
|
||||
return os_remove_leaf(path)
|
||||
end
|
||||
|
||||
elsa = {
|
||||
@ -130,6 +132,22 @@ local function boot()
|
||||
windowEventID = wen,
|
||||
}
|
||||
|
||||
-- redirect os.remove is non posix
|
||||
if os.getenv('os') == 'Windows_NT' then
|
||||
local os_remove = os.remove
|
||||
os_remove_leaf = function(path)
|
||||
local mode = lfs.attributes(path,"mode")
|
||||
if mode == nil then
|
||||
return false
|
||||
elseif mode == "directory" then
|
||||
return lfs.rmdir(path)
|
||||
else -- remove file
|
||||
return os_remove(path)
|
||||
end
|
||||
end
|
||||
os.remove = elsa.remove
|
||||
end
|
||||
|
||||
require("main")
|
||||
|
||||
local e = ffi.new('SDL_Event')
|
||||
|
Loading…
x
Reference in New Issue
Block a user