Is there a way to detect if the System is XDG independently of the environment variables?
Jesús Gómez
jgomo3 at gmail.com
Fri Apr 12 00:18:07 UTC 2024
A direct message informed me that FreeBSD would use `/usr/local/etc/xdg` as
the default for `$XDG_CONFIG_DIRS`.
Does anybody know how they make applications that strictly follow the XDG
Base Directory specifications work fine in their system? Is FreeBSD
guaranteeing the existence of the $XDG_CONFIG_DIRS?
I've been searching for inspiration in some open code bases, and so far,
the default is FIXED in the code to `/etc/xdg`. Two examples are Emacs xdg
library[1] and java-xdg[2].
Besides this, do you think it is a sane heuristic to check for
$XDG_CONFIG_DIRS or /etc/xdg as explained previously?
[1]
https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/xdg.el?id=0fab2649e288c7a350018293443e709eba6b0fe2#n131
[2]
https://github.com/omajid/xdg-java/blob/a6cab0e204190d65632d9f4d073093aeda074c9c/src/main/java/org/freedesktop/BaseDirectory.java#L107
El mié, 10 abr 2024 a la(s) 9:02 p.m., Jesús Gómez (jgomo3 at gmail.com)
escribió:
> I'm going to make a claim.
>
> """ Your process runs in a system following XDG if the environment
> variable XDG_CONFIG_DIRS is defined OR the folder /etc/xdg exists. """
>
> Two things are essential to make that claim. The name of the folder uses
> the term `xdg`. This is different than the rules mentioning `/usr/share`
> or the folders at $HOME (e.g. $HOME/.config) in 2 aspects: 1, folders like
> `/usr/share` are not unique to systems following the XDG convention; 2, the
> folders at $HOME could not exists at first, and still be in a system
> following the conventions and so, the process could create those folders in
> the first place.
>
> A test like this (if the assumptions I made are valid) could be used by
> applications like Clojure (my current interest) to switch between
> supporting or not XDG.
>
> But first, I would like to verify that this claim makes sense to you. I
> would appreciate any feedback you can give me.
>
>
> El vie, 29 mar 2024 a la(s) 2:48 p.m., Jesús Gómez (jgomo3 at gmail.com)
> escribió:
>
>> Hi.
>>
>> I understand that the XDG_* environment variables are options for the
>> users to customize their system, but the lack of them doesn't mean that the
>> system is not following XDG.
>>
>> I've been thinking about this, and the more I read the specifications, it
>> seems to me that "Systems" don't have that responsibility and it is just an
>> decision of the applications to follow the specifications or not.
>>
>> I'm thinking this because of the Clojure CLI tool. I've been discussing
>> about this with the maintainers and there are 2 options:
>>
>> 1. Or Clojure could detect that the system is following the XDG
>> specifications (even when no XDG environment variables are in place).
>> 2. Define a flag at any time (installation, execution, packaging, etc., I
>> think they will decide that part) for following these specs.
>>
>> I think the more probable path is the flag, and it corresponds with the
>> idea that the System doesn't have a responsibility to express whether it
>> follows or not the specifications; but still, given only curiosity, I would
>> still like to know if the Systems can publish that or if an application can
>> detect that.
>>
>> Thank you!
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/xdg/attachments/20240411/eb88df53/attachment.htm>
More information about the xdg
mailing list