mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2025-03-23 02:19:40 +00:00
fixes generation errors if CS+ folder was ever dropped onto the window
This commit is contained in:
parent
4c8e6933f3
commit
9d42f9be93
13
src/main.lua
13
src/main.lua
|
@ -47,10 +47,23 @@ local function recursiveWrite(path, name)
|
|||
end
|
||||
end
|
||||
|
||||
local function recursivelyDelete( item )
|
||||
if lf.getInfo( item , "directory" ) then
|
||||
for _, child in ipairs( lf.getDirectoryItems( item )) do
|
||||
recursivelyDelete( item .. '/' .. child )
|
||||
lf.remove( item .. '/' .. child )
|
||||
end
|
||||
elseif lf.getInfo( item ) then
|
||||
lf.remove( item )
|
||||
end
|
||||
lf.remove( item )
|
||||
end
|
||||
|
||||
function love.directorydropped(path)
|
||||
local success = Randomizer:_mountDirectory(path)
|
||||
--Randomizer:_unmountDirectory(path)
|
||||
if success then
|
||||
recursivelyDelete('csdata') -- completely clear the folder, in case of user error :)
|
||||
recursiveWrite('mounted-data', 'csdata')
|
||||
Settings.settings.csdirectory = 'csdata'
|
||||
Settings:update()
|
||||
|
|
Loading…
Reference in a new issue