XorTroll / Goldleaf

🍂 Multipurpose homebrew tool for Nintendo Switch
GNU General Public License v3.0
2.65k stars 349 forks source link

Use system config directory for Quark's config file #691

Closed TomaSajt closed 1 year ago

TomaSajt commented 1 year ago

This PR will change Quark's config file's default location.

Reason for PR: my Quark .jar file is in a write-protected directory, so it can't create the config file.

(Trying to package Quark for nixpkgs, where every package is write-protected) (see https://github.com/NixOS/nixpkgs/pull/251015)

Previously, the program would place the config next to Quark's .jar file, or if it couldn't find it, it just used the working directory (I think).

After this PR, the quark-config.cfg file will be created in $XDG_CONFIG_HOME/quark, or if the env-var is not set, it will just use $HOME/.config/quark. ($XDG_CONFIG_HOME is usually just $HOME/.config)

It should work on Windows as well, placing it C:/Users/CurrentUser/.config/quark.

Specifying the config file via -cfgfile should still work.


This will be a small semi-breaking change, but I doubt people can't move or re-add their config files.

If there are any changes needed to be made, let me know.

XorTroll commented 1 year ago

Thanks for this! I was never fully convinced by placing the config file in the JAR's directory or in the cwd, but I never got to improve this

XorTroll commented 1 year ago

The codestyle doesn't fully match mine but that's not a big deal ;)