surge-synthesizer / stochas

The Stochas Sequencer
https://stochas.org
GNU General Public License v3.0
410 stars 35 forks source link

Configuration files on Linux should go in a hidden folder #85

Open elcalenx opened 2 years ago

elcalenx commented 2 years ago

This is a bit of a pet peeve for me, and something I far too often encounter with software ported to linux... After trying out Stochas, I discovered that an 'AudioVitamins' folder had appeared in my home folder. The standard practise for linux software is to place configuration files in hidden folders, so that they don't clutter the user's home folder. For instance in a folder inside '~/.config', which is a location many apps use...

baconpaul commented 2 years ago

${XDG_CONFIG_HOME}/AudioVitamins seems like it would be the correct choice right? And if XDG_CONFIG_HOME is null choose ${HOME}/.config

elcalenx commented 2 years ago

That sounds right to me. It doesn't look like XDG_CONFIG_HOME is set by default on my Debian system, but a lot of software appears to default to ~/.config.

baconpaul commented 2 years ago

Just a quick note to self

Stochas uses juce::ApplicationProperties here which uses juce::PropertiesFile

juce 6.1.1 defines the location of this file as

auto dir = File (commonToAllUsers ? "/var" : "~")
                      .getChildFile (folderName.isNotEmpty() ? folderName
                                                             : ("." + applicationName));

but since we set folderName then, voila, you get the folder name which is the application and the "~/.AudioVitamins" path isn't crossed.

So this will require an #if LINUX of some form in src/EditorState.cpp basically to set the folder name to the XDG recipe contemplated above, in two spots (when we read and write).