Added wrapping in boot.lua so SAVE dir is only created when written to
This commit is contained in:
@@ -37,9 +37,22 @@ function love.boot()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set write directory and mount
|
-- Init the save directory - if it doesn't exist (can't be mounted)
|
||||||
love.filesystem.setWriteDir("save")
|
-- love.filesystem.write() is wrapped so that it is only set, created and
|
||||||
love.filesystem.mount("save")
|
-- mounted when write() is called
|
||||||
|
local savedir = "save"
|
||||||
|
local mounted = love.filesystem.mount(savedir)
|
||||||
|
if mounted then
|
||||||
|
love.filesystem.setWriteDir(savedir)
|
||||||
|
else
|
||||||
|
local old = love.filesystem.write
|
||||||
|
love.filesystem.write = function(...)
|
||||||
|
love.filesystem.setWriteDir(savedir)
|
||||||
|
love.filesystem.mount(savedir)
|
||||||
|
love.filesystem.write = old
|
||||||
|
return old(...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Load main.lua or init `nogame` state
|
-- Load main.lua or init `nogame` state
|
||||||
if love.filesystem.isFile("main.lua") then
|
if love.filesystem.isFile("main.lua") then
|
||||||
|
|||||||
Reference in New Issue
Block a user