misc
This commit is contained in:
parent
f8e3d78332
commit
b9b0726506
6 changed files with 140 additions and 81 deletions
11
_helpers.lua
11
_helpers.lua
|
|
@ -48,8 +48,15 @@ end
|
|||
|
||||
-- Runtime saves live in LÖVE's write directory. This deliberately uses only
|
||||
-- love.filesystem operations: they cannot delete files from the source tree.
|
||||
function clearRuntimeSaveData()
|
||||
function clearRuntimeSaveData(roomName)
|
||||
local removed = 0
|
||||
if roomName then
|
||||
-- love.filesystem.remove only affects the writable save directory, never
|
||||
-- the shipped/source room with the same path.
|
||||
if love.filesystem.remove("rooms/" .. roomName .. ".sav") then removed = 1 end
|
||||
return removed
|
||||
end
|
||||
|
||||
local function removeTree(path)
|
||||
if love.filesystem.isDirectory(path) then
|
||||
for _, child in ipairs(love.filesystem.getDirectoryItems(path)) do
|
||||
|
|
@ -60,7 +67,7 @@ function clearRuntimeSaveData()
|
|||
end
|
||||
|
||||
-- These are the only files this game writes through love.filesystem: room
|
||||
-- autosaves and the generated asset cache. Source levels are read-only to
|
||||
-- autosaves and the generated asset cache. Source levels are read-only to
|
||||
-- this API and cannot be removed here.
|
||||
removeTree("rooms")
|
||||
if love.filesystem.remove("assets.prop") then removed = removed + 1 end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue