question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use proper preferences directories on desktop

See original GitHub issue

Issue details

Currently, by default, libGDX Preferences are saved to ~/.prefs on Linux, which is nonstandard. The XDG Base Directory specification suggests that, to determine where to write configuration files to, programs should:

  • First try the environment variable $XDG_CONFIG_HOME.
  • If the environment variable is unset, default to $HOME/.config.

This standard serves to make the home directory cleaner, and normalize the way different programs save their configurations.

If this is adopted in libGDX, it would likely be necessary to check the (then legacy) ~/.prefs path in addition to the above two paths, as to not break existing configurations.

This is somewhat similar to #6367, but not the same as this pertains to preferences rather than local storage.

Please select the affected platforms

  • Android
  • iOS
  • HTML/GWT
  • Windows
  • Linux
  • MacOS

Thanks!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

5reactions
lyze237commented, Jun 9, 2021

While at it, it’d also be cool to save prefs in %appdata% on windows and in ~/Library/Preferences on macos. As those are also more recommended to save program preferences in.

2reactions
crykncommented, Jul 31, 2021

I agree with @lyze237. The backend/platform can already be queried by calling Gdx.app.getType() and the OS can be determined via UIUtils, so there is no need for this class.

@tommyettinger: If it’s in the LWJGL3 backend, it can only be used from that backend, which requires a lot more work to actually use in the core part of an app.

Why would the core part of the app need to know where the preferences are saved on desktop? I think this is an implementation detail of Lwjgl3Preferences (as well as Lwjgl2Preferences and HeadlessPreferences) and doesn’t belong in core.

Also the Android and iOS stuff is unnecessary as those backends don’t save their preferences in certain directories, but rather use some platform specific stuff, and in addition, I don’t think System.getProperty("os.name") works on GWT.

@tommyettinger: Also, Lyze you’re saying two opposite things – there are already checks for the platform in core, but these checks don’t belong in core…?

I think what Lyze meant is that there are already checks in core (i.e., Gdx.app.getType(), UIUtils) and that is all well, but the additional methods (getUserDataDirectory, getUserConfigDirectory) don’t belong in core.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ways to organize files on your Mac desktop - Apple Support
Organize items into folders​​ You can quickly group items on the desktop into folders. Select all the items you want to group, Control-click...
Read more >
Working with Windows Settings Preference Items Using the ...
In the console tree under User Configuration, expand the Preferences folder, and then expand the Windows Settings folder. Right-click the ...
Read more >
How to Adjust Folder Settings in Windows 7 - YouTube
This tutorial will show you how to adjust the folder settings in Windows 7.Don't forget to check out our site http://howtech.tv/ for more ......
Read more >
Setting Folder Preferences
To access the Folders preference tool, click Launch, then choose Preferences -> Desktop Preferences -> Folders. Alternatively, you can use the File ...
Read more >
The Desktop and Finder Preferences - Mac OS X - InformIT
Launch System Preferences manually. It is located in the system's Applications folder (path: /Applications/System Preferences). After System ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found