mirror of
https://github.com/zenith391/OCEmu.git
synced 2025-09-29 07:53:29 -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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local os_remove_leaf = os.remove
|
||||||
|
|
||||||
local recursiveDelete
|
local recursiveDelete
|
||||||
function recursiveDelete(path)
|
function recursiveDelete(path)
|
||||||
local mode = lfs.attributes(path,"mode")
|
local mode = lfs.attributes(path,"mode")
|
||||||
@ -62,11 +64,11 @@ local function boot()
|
|||||||
if mode == "directory" then
|
if mode == "directory" then
|
||||||
recursiveDelete(path .. "/" .. entry)
|
recursiveDelete(path .. "/" .. entry)
|
||||||
end
|
end
|
||||||
os.remove(path .. "/" .. entry)
|
os_remove_leaf(path .. "/" .. entry)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return os.remove(path)
|
return os_remove_leaf(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
elsa = {
|
elsa = {
|
||||||
@ -130,6 +132,22 @@ local function boot()
|
|||||||
windowEventID = wen,
|
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")
|
require("main")
|
||||||
|
|
||||||
local e = ffi.new('SDL_Event')
|
local e = ffi.new('SDL_Event')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user