Can't manage to filesystem.write nor filesystem.createDirectory

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
svalorzen
Prole
Posts: 22
Joined: Tue Sep 27, 2022 8:25 am

Re: Can't manage to filesystem.write nor filesystem.createDirectory

Post by svalorzen »

Uuh, that's quite a good guess. I wouldn't call it weird partitioning, but I do have `.local` as a symlink to a folder in another partition (of an SSD, my home is on an HDD). I also really hope it's not this, I'm not sure I'd be able to fix it :P
svalorzen
Prole
Posts: 22
Joined: Tue Sep 27, 2022 8:25 am

Re: Can't manage to filesystem.write nor filesystem.createDirectory

Post by svalorzen »

ARGHH, that's what it is! In `physfs.c`, the function that is supposed to create (recursively) the directory is called `doMkdir`. Inside, there is a loop that splits the incoming directory name by '/' (so that it can examine one piece at a time and generate the directories recursively).

If the directory already exists however, there is a special check to verify that each step of the way is indeed a directory:

Code: Select all

retval = ((rc) && (statbuf.filetype == PHYSFS_FILETYPE_DIRECTORY));
However, in my case, `.local` is not a directory but a symlink! So the entire thing fails! This seems to be a fairly dumb oversight though, no? Should I report this somewhere?

Another thing which is annoying is that this type of error is not really considered; so LOVE in the end only gets "not found" as an error, which would make it harder to also report the problem to the user -- not that it's trying to currently, but still.
svalorzen
Prole
Posts: 22
Joined: Tue Sep 27, 2022 8:25 am

Re: Can't manage to filesystem.write nor filesystem.createDirectory

Post by svalorzen »

And it seems that the latest version of physfs has this fixed; going to the GitHub repo I checked and it seems that the relevant line has been changed:

Code: Select all

retval = ( (rc) && ((statbuf.filetype == PHYSFS_FILETYPE_DIRECTORY) || (statbuf.filetype == PHYSFS_FILETYPE_SYMLINK)) );
I wonder if I'm really so unlucky that I'm stumbling in all these problems xD Any idea on whether love will at some point integrate this? I guess for now I can just clean up the repo on my machine, fix the problem and use my compiled binary..

EDIT: to avoid adding one more post; I have verified that simply replacing the offending line with the one I wrote above fixes the problem.. now my save directory is correctly created and I can write to it :)
Andlac028
Party member
Posts: 174
Joined: Fri Dec 14, 2018 2:27 pm
Location: Slovakia

Re: Can't manage to filesystem.write nor filesystem.createDirectory

Post by Andlac028 »

You can try to look at love’s github repo into development branch, if it will be fixed in 12.0, and if not, you may try to suggest it in issues.
svalorzen
Prole
Posts: 22
Joined: Tue Sep 27, 2022 8:25 am

Re: Can't manage to filesystem.write nor filesystem.createDirectory

Post by svalorzen »

Thanks, I just checked, it seems physfs' version there is the same as in 11.4. I have opened an issue about this, will keep this posted :)
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests