Page 1 of 1

love.filesystem.getInfo() Searching only game files and not Save files

Posted: Thu Nov 19, 2020 9:21 pm
by MoodyH8s
When I do this

Code: Select all

if love.filesystem.getInfo('options.txt') == nil then
        file = love.filesystem.createDirectory('options')  
getInfo searches for options.txt inside the same directory that main.lua instead of the SaveDIrectory and createDirectory creates
the folder in the SaveDirectory.

when I write this

Code: Select all

love.filesystem.getSaveDirectory( )
it outputs the correct saveDirectory, within appdata, but getInfo does not search there.

So my question ultimately is , how do I search if a file exists inside of the savedirectory. How do I search the saveDirectory

I have looked online and in the documentation , but they all assume that getInfo IS searchingin the saveDirectory.

Thanks in advance!

Re: love.filesystem.getInfo() Searching only game files and not Save files

Posted: Fri Nov 20, 2020 2:29 pm
by pgimeno
The following main.lua works for me:

Code: Select all

love.filesystem.write('abc.txt', 'abc')

function love.draw()
  love.graphics.print(love.filesystem.getInfo('abc.txt').type)
end
There may be something you're not doing properly, but we can't do much with that little information.

Re: love.filesystem.getInfo() Searching only game files and not Save files

Posted: Fri Nov 20, 2020 4:41 pm
by zorg
It is, and even if you have a file with the same name and path in both your save directories AND the game's directory (relative to main.lua), by default, precedence goes to the save directory... the only two things i can think of is either
- you didn't set an identity for your project, so there's no save directory, and/or
- you changed the precedence of the save folder to come after where main.lua is.

Re: love.filesystem.getInfo() Searching only game files and not Save files

Posted: Fri Nov 20, 2020 6:10 pm
by MoodyH8s
zorg wrote: Fri Nov 20, 2020 4:41 pm It is, and even if you have a file with the same name and path in both your save directories AND the game's directory (relative to main.lua), by default, precedence goes to the save directory... the only two things i can think of is either
- you didn't set an identity for your project, so there's no save directory, and/or
- you changed the precedence of the save folder to come after where main.lua is.
I 100% thought the exact same thing as you did , I really did try and understand this completely. It completely works fine with using an outdated love.filesytem.exists. It works completely fine with 0 issues as intended. All other older seperated versions of getInfo() work just fine, but getInfo does not.

Edit: WHILE I WAS WRITING THIS. my exact code up there started working. I have not changed any directories since it wasn't working. I checked all Directories by printing them and everything has been the same. I don't know why it started working but I can say that it probably something I did and hopefully never have to deal with something like that again.