mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 14:19:02 -06:00
Small cleanup to file info checking
This commit is contained in:
parent
6c201596b0
commit
56fb5aebea
@ -1,8 +1,10 @@
|
|||||||
local binser = require 'libs.binser'
|
local binser = require 'libs.binser'
|
||||||
|
|
||||||
function loadSave()
|
function loadSave()
|
||||||
local info = love.filesystem.getInfo(love.filesystem.getSaveDirectory())
|
local info = love.filesystem.getInfo(
|
||||||
if not info or info.type ~= "directory" then
|
love.filesystem.getSaveDirectory(), "directory"
|
||||||
|
)
|
||||||
|
if not info then
|
||||||
love.filesystem.remove(love.filesystem.getSaveDirectory())
|
love.filesystem.remove(love.filesystem.getSaveDirectory())
|
||||||
love.filesystem.createDirectory(love.filesystem.getSaveDirectory())
|
love.filesystem.createDirectory(love.filesystem.getSaveDirectory())
|
||||||
end
|
end
|
||||||
|
4
main.lua
4
main.lua
@ -99,8 +99,8 @@ function love.keypressed(key, scancode)
|
|||||||
-- f12 is reserved for saving screenshots
|
-- f12 is reserved for saving screenshots
|
||||||
elseif scancode == "f12" then
|
elseif scancode == "f12" then
|
||||||
local ss_name = os.date("ss/%Y-%m-%d_%H-%M-%S.png")
|
local ss_name = os.date("ss/%Y-%m-%d_%H-%M-%S.png")
|
||||||
local info = love.filesystem.getInfo("ss")
|
local info = love.filesystem.getInfo("ss", "directory")
|
||||||
if not info or info.type ~= "directory" then
|
if not info then
|
||||||
love.filesystem.remove("ss")
|
love.filesystem.remove("ss")
|
||||||
love.filesystem.createDirectory("ss")
|
love.filesystem.createDirectory("ss")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user