fix: replace deprecated function

This commit is contained in:
Kazhnuz 2021-04-05 12:07:21 +02:00
parent 207d37eddc
commit 1b0091937f

View file

@ -94,7 +94,7 @@ function Game:getMetadataFile(absolute)
local dir = ""
if absolute then
dir = love.filesystem.getSaveDirectory() .. "/"
if not love.filesystem.exists(dir) then
if not utils.filesystem.exists(dir) then
love.filesystem.createDirectory( "" )
end
end
@ -104,11 +104,10 @@ function Game:getMetadataFile(absolute)
return filepath
end
function Game:getMetadata()
local metadata = {}
local filepath = self:getMetadataFile(true)
if love.filesystem.exists("metadata.save") then
if utils.filesystem.exists("metadata.save") then
metadata = binser.readFile(filepath)[1]
else
metadata = self:newMetadata()
@ -153,7 +152,7 @@ function Game:read(save_id)
self.slot = save_id
if (self.slot > 0) then
local filepath = self:getSaveFile(self.slot, true)
if love.filesystem.exists("save" .. self.slot .. ".save") then
if utils.filesystem.exists("save" .. self.slot .. ".save") then
local loadedDatas = binser.readFile(filepath)
self:setData(loadedDatas[1])
@ -175,7 +174,7 @@ function Game:getSaveFile(saveslot, absolute)
local dir = ""
if absolute then
dir = love.filesystem.getSaveDirectory() .. "/"
if not love.filesystem.exists(dir) then
if not utils.filesystem.exists(dir) then
love.filesystem.createDirectory( "" )
end
end
@ -188,7 +187,7 @@ end
function Game:resetSaves()
for i=1, self.slotNumber do
local filepath = self:getSaveFile(i, true)
if love.filesystem.exists("save" .. i .. ".save") then
if utils.filesystem.exists("save" .. i .. ".save") then
love.filesystem.remove( "save" .. i .. ".save" )
end
end