XDG_CONFIG_DIRS an /usr/local/etc/xdg

Elsie Hupp xdg at elsiehupp.com
Thu Sep 16 16:38:37 UTC 2021


> The value of XDG_CONFIG_DIRS, if set, is expected to be a string designating one or more directories to search for config files, in priority order. If multiple directories are specified then they are separated by colon characters (:).  This represents a search path, similar to the executable search path conveyed via $PATH.

I did see that XDG_CONFIG_DIRS returns a single string with colon separators. GLib and Qt just use their own preferred data structures instead (as a convenience).

> HOWEVER, Base Directory does not specify a first match wins rule.  It attributes more importance (the spec's terminology) to files located in earlier directories in the list, but that does not imply that only one can be used.  A viable alternative is for applications to look for their config files in all the specified directories, and to merge the contents according to priority when more than one is found.  At least a limited ability to merge multiple configs is suggested by the provision for XDG_CONFIG_HOME, which designates a user-specific search directory of even higher importance that, alone among all these, is assumed to be writable by the user.  This latter is where a user would record their personal config customizations, and a user-friendly application with many configuration options will not insist that users provide a complete configuration just to customize a few items.

Thanks for the best-practice advice!


More information about the xdg mailing list