Alternate Windows's save directory for love.filesystem

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.
Post Reply
User avatar
vico
Prole
Posts: 23
Joined: Mon Nov 13, 2017 9:43 pm

Alternate Windows's save directory for love.filesystem

Post 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).
User avatar
dusoft
Party member
Posts: 514
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

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

Post 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.
User avatar
togFox
Party member
Posts: 780
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

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

Post 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-)
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

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

Post 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
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
vico
Prole
Posts: 23
Joined: Mon Nov 13, 2017 9:43 pm

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

Post 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.
Post Reply

Who is online

Users browsing this forum: Ollie.ha and 4 guests