Question regarding $XDG_DATA_DIRS
Elsie Hupp
xdg at elsiehupp.com
Mon Oct 17 04:32:37 UTC 2022
There are some scenarios where using or not using the trailing slash does actually make a difference, perhaps most prominently in the command-line arguments for rsync.
(I can never remember which is correct for a given behavior, so I invariably choose wrong. 🤷🏻♀️)
> On Oct 16, 2022, at 11:16 AM, Lennart Poettering <mzkqt at 0pointer.de> wrote:
>
> 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