I’m creating a project that I want to be able to distribute across platforms. I’m writing in Java and AWT which already gives me a pretty large range of devices, but I’m mostly interested in Windows and Linux (Debian/Ubuntu).
I’m trying to determine where I should put config files. I have application-wide configuration files and user-specific files. Where are common directories to put these files?
Here’s my current setup:
Windows:
App Config: %PROGRAMDATA%MyAppconfig
User Config: %USERPROFILE%AppDataLocalMyApp
Other:
App Config: /opt/MyApp/config
User Config: $HOME/.MyApp/
3
This sounds OK, it’s pretty much what most software does. But in Linux, you might want to put the app configuration files in /etc
(or under a subdirectory, e.g. /etc/myapp
) as it’s more fitting to the FHS:
/etc
Host-specific system-wide configuration files
Also, you might want to put user configuration in ~/.config/MyApp
rather than ~/.MyApp
. This helps reduce clutter in the user’s home directory.
1
I’m no expert, but in my experience, Linux puts some default (non-editable) config files in /etc/your-app-here
, whereas user-editable config files these days go in ~/.config/your-app-here
(that is $HOME/.config/your-app-here
)
Reference link
1