fixes generation errors if CS+ folder was ever dropped onto the window

This commit is contained in:
duncathan 2020-02-25 20:06:06 -06:00
parent 4c8e6933f3
commit 9d42f9be93

View file

@ -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()