5 ms·
I consider it good practice to allow users to customize where your program creates files. I don't like $HOME to be the default dumping ground for anything I ru
by keyist 14y ago
I consider it good practice to allow users to customize where your program creates files. I don't like $HOME to be the default dumping ground for anything I run.
A standard that uses environment variables means programs don't have to provide extra options for this customization (I've seen -f,--file , -c,--config and other variants). It allows for common code (libraries that implement the spec).
If you poke around for feature requests for various open source programs, you'll find XDG basedir compliance come up occasionally (moreso for CLI utils). I wouldn't say "nobody seems to be using it"; quick scan of my folders includes Chromium, uzbl, htop. Git's next release will be compliant too.
- tedunangst 14y agoI don't particularly like dumping everything in home, but XDG is worse. Now, if I want to start over with a clean profile, there's a whole list of locations I have to zap. Spraying shit in three directories is worse than one.
- johnny22 14y agomy problem with that "one" directory is that i have to take care specifically to back it up. applications that at least use ~/.cache means i don't have to worry about backing up a bunch of useless stuff.
- yaix 14y agoIsn't that what /tmp is for? Why not put cache files into /tmp/<username> with 0700 permission?
- daxelrod 14y agoNo, that's not necessarily what /tmp is for. Consider a browser cache. /tmp is not guaranteed to be preserved between program invocations[1]. /var/tmp [2] might be a better place. /var/cache [3] is intended for exactly this kind of thing. Unfortunately, it can be far more useful for an administrator in a multi-user setup to want user-specific caches in home directories. That way, you get all of the infrastructure for managing user data for free, like quotas. Also note: if you're considering putting data into /tmp or /var/tmp, please honor the TMPDIR environment variable, if it is set[4]. [1]: http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFIL... [2]: http://www.pathname.com/fhs/pub/fhs-2.3.html#VARTMPTEMPORARYFILESPRESERVEDBETWEE http://www.pathname.com/fhs/pub/fhs-2.3.html#VARTMPTEMPORARY... [3]: http://www.pathname.com/fhs/pub/fhs-2.3.html#VARCACHEAPPLICATIONCACHEDATA http://www.pathname.com/fhs/pub/fhs-2.3.html#VARCACHEAPPLICA... [4]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03 http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_...
- anamax 14y ago> If you poke around for feature requests for various open source programs, you'll find XDG basedir compliance come up occasionally (moreso for CLI utils). What fraction of those requests are by XDG advocates? I ask because every standard comes with folks insisting that it be followed. While those folks claim to represent the interests of users, those requests are different.
- adbge 14y agoI have made this specific feature request on an application (Mangler) and I have no affiliation with XDG.