but please don’t hard-code ~/.config
or $HOME/.config
. Use the XDG_CONFIG_HOME
environment variable, with $HOME/.config
as a fallback if it’s not set.
Many programming languages have a cross-platform implementation of this built in to their standard library. C# has Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
which uses XDG_CONFIG_HOME on Linux, local AppData on Windows, and whatever is the correct thing on MacOS (not very familiar with how things work on MacOS)
Thanks for the info. It looks like that’s what .NET / C# uses: https://github.com/dotnet/runtime/blob/2b60d82ef3e87876128b7f71922a1b72908b6fcf/src/libraries/System.Private.CoreLib/src/System/Environment.GetFolderPathCore.Unix.cs#L103