Question regarding $XDG_DATA_DIRS

Lennart Poettering mzkqt at 0pointer.de
Sun Oct 16 15:16:20 UTC 2022


On Do, 13.10.22 00:56, Akbarkhon Variskhanov (akbarkhon.variskhanov at gmail.com) wrote:

> Hi.
>
> I noticed that the default value has a trailing slash for both directories:
>
> > If $XDG_DATA_DIRS is either not set or empty, a value equal to /usr/local/share/:/usr/share/ should be used.
>
> I was wondering what's the benefit of including a trailing slash? Is
> there a specific purpose to it or is it a typo? With all due respect,
> it looks so out of place. Path-related variables usually strip it off.
>
> Sorry if I'm asking in the wrong place.

Behaviour should be the same, hence it doesn't matter.

Note that the root dir "/" necessarily ends in a slash, so it might
make sense to always suffix dirs like that, to make the root dir less
special.

In systemd documentation we have the rule to always suffix dirs with
"/", to communicate that they are dirs.

But seriously, whether to suffix dirs or not, effect is the same. And
to some level it's a bikeshedding questions wether to suffix or not.

Lennart

--
Lennart Poettering, Berlin


More information about the xdg mailing list