Hey folks,
In Moonring, I've now changed the data structure in the Love file to have its own SAVE folder, so I can pull files from that as default.
The game still has to create writable directories for the player with the same name in order for this to be useful.
However, when I try using love.filesystem.getInfo, it returns non-null, presumably because the save directory DOES exist... in the love file! Is there any standard way to tell whether the directory that is found exists in the love file or the save directory?
What I am trying to do is create the actual empty save directories if they don't exist, but I can't do that if the tests keep telling me that it already exists!
- Dene
More filesystem questions
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: More filesystem questions
I am assuming this is correct?
Code: Select all
local dir = love.filesystem.getRealDirectory(TEMP_PATH)
local dir2 = love.filesystem.getSaveDirectory()
if dir ~= dir2 then
love.filesystem.createDirectory(TEMP_PATH)
end
-
- Party member
- Posts: 559
- Joined: Wed Oct 05, 2016 11:53 am
Re: More filesystem questions
love.filesystem.createDirectory creates the requested directories. However, if the directories already exist, the function basically does nothing. The return value (boolean) will tell you if the request was a success (created/exists) or not (could not create directory).
Re: More filesystem questions
Oh, so I could have basically not bothered checking! Thanks for that!
Re: More filesystem questions
EAFP (Easer to ask for forgiveness than permission)
Re: More filesystem questions
As long as you can guarantee that you have write access to the folder, yes. Otherwise your saves etc will start failing inexplicably.
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
Who is online
Users browsing this forum: Ahrefs [Bot] and 11 guests