Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libGDX does not use the recommend directories for local storage on desktop. #6367

Open
gitpicard opened this issue Jan 25, 2021 · 1 comment

Comments

@gitpicard
Copy link

Good evening,

Currently libGDX does not follow best practices to store local files (those accessed via Gdx.files.local) on the desktop operating systems. Currently, it seems to just use the working directory. I would like to purpose changing libGDX to use the correct directory for the operating system. It would use the AppData folder on Windows, the correct folder for Mac, and for Linux we can probably keep the same behavior. I would hope that most developers did not write their code with the assumption that internal files and local files are both in the same path since this change would likely break any code that makes that assumption. To get around that, we could have it so that by default libGDX uses the current behavior but can optionally be switched to follow the best practices for the operating system. Perhaps a function called setStorage can be added to the ApplicationConfiguration class? This function would take a boolean as a parameter and when set to true, it would use the AppData folder instead of what it currently does.

I would be willing to take the time to implement this code but I only have a Windows machine and a Ubuntu machine. I would need someone with a Mac to test.

Is this something that I should pursue or that the greater community is interested in?

@tommyettinger
Copy link
Member

I think many games actually would prefer using the current working directory for local files, since AppData is a hidden folder by default on Windows. Many users who might want to access a locally-saved backup or some other locally-written file could lack the knowledge or permissions to access their AppData folder. I think if there is a change, there needs to be a way to configure the location, as with the suggested setStorage. There might be benefits to having presets for the appropriate AppData subfolder (which might already be used by Preferences, but I'm not sure), the current working directory, and maybe a temp folder. I think the default should remain as-is, but by having the configurable setStorage, games can save files hopefully more how they want to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants