Page 1 of 1

Alternate Windows's save directory for love.filesystem

Posted: Sat Apr 20, 2024 1:57 pm
by vico
Hello!

Reading about love.filesystem on Love wiki, i saw that it creates a sandboxed environment and exposes only a subfolder (either Love\<game> for unfused or just <game> if fused) within %AppData% (C:\Users\<user>\AppData\Roaming) to be written by the game.

Althrough i'm okay with the sandbox aspect, i would like to know if there is a way to change the default save folder (on Windows only) from %AppData% to another Known Folder, like Documents/My Documents or even Saved Games (that should be the default for games to store save data at least until Windows 7). A little OCD trigger from my IT days seeing such kind of data being written under the AppData\Roaming folder.

There is a C/C++ function in Windows API that can fetch the path of such kind of "special" folder (since they can be moved around by the user), but i'm not proeficient enough in C/C++ to try to apply it via ffi and modify the love.filesystem to reflect this change (on Windows-only, of course).

Re: Alternate Windows's save directory for love.filesystem

Posted: Sun Apr 21, 2024 2:10 pm
by dusoft
You can use a generic or a specific Lua library to handle other filesystem calls. That is, using LÖVE you are not constrained to use its functions alone.

However using a generic filesystem handling library comes with some issues such as different OS etc.

Re: Alternate Windows's save directory for love.filesystem

Posted: Mon Apr 22, 2024 1:05 pm
by togFox
My ocd is equally triggered. This works on Windows. Not sure about other os.

https://github.com/EngineerSmith/nativefs

I test for the os the love file is using and if it is Windows then I save to my preferred location (not 'roaming') and if it's not Windows then use vanilla love.filesystem. I don't use those os so that doesn't trigger me. 8-)

Re: Alternate Windows's save directory for love.filesystem

Posted: Mon Apr 22, 2024 2:44 pm
by zorg
I'd say you sadly can't realistically cater to every people's different wishes on this topic. I for one like to keep my data in one place, next to the application that uses it, but that doesn't play well with multi-user systems (besides the fact that i'm the only user of mine) nor "safeties" OS-es apply to your computer for your own benefit, considering the user is always wrong. :3

Re: Alternate Windows's save directory for love.filesystem

Posted: Wed Apr 24, 2024 3:11 pm
by vico
togFox wrote: Mon Apr 22, 2024 1:05 pm My ocd is equally triggered. This works on Windows. Not sure about other os.

https://github.com/EngineerSmith/nativefs

I test for the os the love file is using and if it is Windows then I save to my preferred location (not 'roaming') and if it's not Windows then use vanilla love.filesystem. I don't use those os so that doesn't trigger me. 8-)
I think nativefs is the way i would go. I asked the author if there is a way to, on Windows, to get the path of such special folders. Let's see if it already can be achieved or if they have the interest of implementing it.