Re: Is there a way to detect if the System is XDG independently of the environment variables?
Jesús Gómez <[email protected]> Thu, 11 Apr 2024 21:48:07 -0230
| Newsgroups | gmane.linux.xdg.devel |
|---|---|
| Message-ID | <CAO9z-96L67Yno7uD3nZxnci-g6ADZmOtWjF47RV+XjY=7t4baw@mail.gmail.com> |
--00000000000078d09d0615db3585 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=3D0fab2649e= 288c7a350018293443e709eba6b0fe2#n131 [2] https://github.com/omajid/xdg-java/blob/a6cab0e204190d65632d9f4d073093aeda0= 74c9c/src/main/java/org/freedesktop/BaseDirectory.java#L107 El mi=C3=A9, 10 abr 2024 a la(s) 9:02=E2=80=AFp.m., Jes=C3=BAs G=C3=B3mez (= [email protected]) escribi=C3=B3: > 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 lik= e > `/usr/share` are not unique to systems following the XDG convention; 2, t= he > 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=E2=80=AFp.m., Jes=C3=BAs G=C3=B3mez (jgo= [email protected]) > escribi=C3=B3: > >> 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, i= t >> 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 wo= uld >> still like to know if the Systems can publish that or if an application = can >> detect that. >> >> Thank you! >> > --00000000000078d09d0615db3585 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div><div><div>A direct message informed me that FreeBSD w= ould use `/usr/local/etc/xdg` as the default for `$XDG_CONFIG_DIRS`.<br><br= ></div>Does anybody know how they make applications that strictly follow th= e XDG Base Directory specifications work fine in their system? Is FreeBSD g= uaranteeing the existence of the $XDG_CONFIG_DIRS?<br><br></div>I've be= en searching for inspiration in some open code bases, and so far, the defau= lt is FIXED in the code to `/etc/xdg`. Two examples are Emacs xdg library[1= ] and java-xdg[2].<br><br></div><div>Besides this, do you think it is a san= e heuristic to check for $XDG_CONFIG_DIRS or /etc/xdg as explained previous= ly?<br></div><div><br>[1] <a href=3D"https://git.savannah.gnu.org/cgit/emac= s.git/tree/lisp/xdg.el?id=3D0fab2649e288c7a350018293443e709eba6b0fe2#n131" = target=3D"_blank">https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/xdg= .el?id=3D0fab2649e288c7a350018293443e709eba6b0fe2#n131</a><br>[2] <a href= =3D"https://github.com/omajid/xdg-java/blob/a6cab0e204190d65632d9f4d073093a= eda074c9c/src/main/java/org/freedesktop/BaseDirectory.java#L107" target=3D"= _blank">https://github.com/omajid/xdg-java/blob/a6cab0e204190d65632d9f4d073= 093aeda074c9c/src/main/java/org/freedesktop/BaseDirectory.java#L107</a></di= v></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr= ">El mi=C3=A9, 10 abr 2024 a la(s) 9:02=E2=80=AFp.m., Jes=C3=BAs G=C3=B3mez= (<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a= >) escribi=C3=B3:<br></div><blockquote class=3D"gmail_quote" style=3D"margi= n:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex= "><div dir=3D"ltr"><div>I'm going to make a claim.<br><br></div><div>&q= uot;"" Your process runs in a system following XDG if the environ= ment variable XDG_CONFIG_DIRS is defined OR the folder /etc/xdg exists.=C2= =A0 """<br></div><div><br></div><div>Two things are essentia= l to make that claim.=C2=A0 The name of the folder uses the term `xdg`.=C2= =A0 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` a= re not unique to systems following the XDG convention; 2, the folders at $H= OME could not exists at first, and still be in a system following the conve= ntions and so, the process could create those folders in the first place.<b= r><br></div><div>A test like this (if the assumptions I made are valid) cou= ld be used by applications like Clojure (my current interest) to switch bet= ween supporting or not XDG.<br><br></div><div>But first, I would like to ve= rify that this claim makes sense to you. I would appreciate any feedback yo= u can give me.<br></div><div><br></div></div><br><div class=3D"gmail_quote"= ><div dir=3D"ltr" class=3D"gmail_attr">El vie, 29 mar 2024 a la(s) 2:48=E2= =80=AFp.m., Jes=C3=BAs G=C3=B3mez (<a href=3D"mailto:[email protected]" targ= et=3D"_blank">[email protected]</a>) escribi=C3=B3:<br></div><blockquote cla= ss=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid = rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div>Hi.<br><br></div><= div>I understand that the XDG_* environment variables are options for the u= sers to customize their system, but the lack of them doesn't mean that = the system is not following XDG.</div><div><br></div><div>I've been thi= nking about this, and the more I read the specifications, it seems to me th= at "Systems" don't have that responsibility and it is just an= decision of the applications to follow the specifications or not.</div><di= v><br></div><div>I'm thinking this because of the Clojure CLI tool.=C2= =A0 I've been discussing about this with the maintainers and there are = 2 options:<br><br></div><div>1. Or Clojure could detect that the system is = following the XDG specifications (even when no XDG environment variables ar= e in place).<br></div><div>2. Define a flag at any time (installation, exec= ution, packaging, etc., I think they will decide that part) for following t= hese specs.<br><br></div><div>I think the more probable path is the flag, a= nd it corresponds with the idea that the System doesn't have a responsi= bility 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.<br><br></div><div>Thank you!<br= ></div></div> </blockquote></div> </blockquote></div> --00000000000078d09d0615db3585--