You are not logged in.

#1 2016-02-22 13:03:01

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

[SOLVED] $XDG_RUNTIME_DIR portable fallback

The basedir spec says, "If $XDG_RUNTIME_DIR is not set applications should fall back to a replacement directory with similar capabilities and print a warning message." What would be a good replacement directory which is also available on other Unix systems? My thought is to try in order /run/user/$UID, /var/run/user/$UID, and then may be something in $HOME or /tmp.

Last edited by fsckd (2016-02-24 04:53:50)


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#2 2016-02-22 13:24:01

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,524
Website

Re: [SOLVED] $XDG_RUNTIME_DIR portable fallback

Hmm, there are very rarely that many musts in a specification like that.  Sticking to those criteria would rule out anything under $HOME and probably /tmp too.  /var/run/user/$UID then /run/user/$UID are the only ones that make sense to me.  If both of those are absent it seems like a moot point to me - put the data wherever convientient at that point.  If the filesystem hierarchy standard isn't used on a system, would users of that system be mad that your program didn't abide by the XDG specificiation?  The former seems (to me) to be a higher level than the latter.  So trying to abide by the XDG on a non FHS system just seems silly.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2016-02-24 00:36:03

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: [SOLVED] $XDG_RUNTIME_DIR portable fallback

Thanks, that's a reasonable way to look at it. Between $HOME and /tmp, /tmp is perhaps the better choice. The files can be given restricted permissions and will likely be cleared on reboot.


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

Board footer

Powered by FluxBB