[solved] why does love.filesystem.getInfo return nil on a file that is definitely there?
Posted: Sun Nov 05, 2023 8:13 am
Hiya,
I'm writing a love2d starter template for blind accessible games, and I just got my screen reader c library working from within the .love file by copying it to the save directory... However:
I tried to make the template only copy the file(s) if they weren't already there, but that doesn't seem to be working. I do some code like this:
However, even after the first time of copying the library, getInfo still returns nil, causing it to be copied on every startup. Any idea why this might be? Maybe it doesn't like me using a full path or... something?
Thanks,
-Michael.
P.S. If you want to see the whole project go here: https://git.2mb.codes/~lilmike/love2d-template
I'm writing a love2d starter template for blind accessible games, and I just got my screen reader c library working from within the .love file by copying it to the save directory... However:
I tried to make the template only copy the file(s) if they weren't already there, but that doesn't seem to be working. I do some code like this:
Code: Select all
if love.filesystem.getInfo(love.filesystem.getSaveDirectory() .. "/" ..
libName) == nil then -- The file doesn't exist, we need to copy it
-- Fixme, probably should do sanity checks like size, etc, but this will do for now.
print(love.filesystem.getSaveDirectory() .. "/" .. libName ..
" not found...")
local content = love.filesystem.read(libName)
love.filesystem.write(libName, content)
end
Thanks,
-Michael.
P.S. If you want to see the whole project go here: https://git.2mb.codes/~lilmike/love2d-template