XDG_CONFIG_DIRS an /usr/local/etc/xdg
Peter White
peter.white at posteo.net
Thu Sep 16 04:44:17 UTC 2021
Dear list,
I am having a hard time finding documentation about the best way to make
locally installed software recognize its config dir in
/usr/local/etc/xdg. Of course, the quick and easy answer could be:
$ env XDG_CONFIG_DIRS=/usr/local/etc/xdg foobar
But that is not something one can ask their users if they install
software from an upstream repository. I believe XDG_CONFIG_DIRS is unset
on most systems and thus defaults to /etc/xdg, i.e. returned by
g_get_system_config_dirs(), so most people would have to set it manually
to make software in /usr/local pick up its config from there, which it
should IMO.
One might also think:
# echo XDG_CONFIG_DIR=/usr/local/etc/xdg:/etc/xdg >> /etc/environment
could be the solution, but I believe that can lead to some unexpected
behaviour, when the user also has the distro counterpart of said
software installed, i.e. when they installed the local version to test
it against the distro version. If they then only change PATH to either
prefer the local or the distro version, the latter would also pick the
config which is only meant for the local one. The distro version might
be outdated an contain obsolete settings.
>From what other software (i.e. a shell) does, I believe the correct way
would be to use the /usr/local/etc/xdg when running a local version and
/etc/xdg when running the distro version, if I am not mistaken.
So I guess, my first question is, if XDG_CONFIG_DIRS is even meant to be
used by locally installed software, its default seems to suggest
otherwise? Or is this maybe just an oversight in the spec? I'd find that
hard to believe, given that it's been around for quite a while now, so
my thought process may very well be flawed here.
I have pondered this for a while now and could also not find anything
via search engine or on this list, so I figured I actually ask the ones
who wrote the spec. ;)
Best,
PW
More information about the xdg
mailing list