Closed Earnestly closed 9 years ago
Looks good. The temporary files probably shouldn't go into the config directory though, a better place would be /tmp - perhaps using the suggestions in the comments; and of course we'd need to fall back to $HOME if $XDG_CONFIG_HOME isn't set.
Regarding temporary files the correct location would likely be XDG_CACHE_HOME
(there is XDG_RUNTIME_DIR
but that is typically for sockets or fifos that are bound to the user's login session).
The way the standard works is that these environment variables shouldn't be set by default and the fallback should be used. Each variable has a defined fallback, for example nn the case of XDG_CONFIG_HOME
not being set, you should fallback to HOME/.config
.
Likewise for XDG_CACHE_HOME
, the fallback is HOME/.cache
For legacy projects moving to XDG they do often add a clause which first looks for the old file location, such as HOME/.progn/config
and only then falling back to the XDG Base Dir. You may want to consider doing that here.
Wow, thank you, I had forgotten about this.
This is a feature request for supporting the XDG Base Directory Specification.
The specification works around a bug during the early UNIX v2 rewrite which caused files prepended with a '.' to be ignored from the output of
ls
. While this "bug" has become a feature for some, it has also become a headache for users when developers continue to assumeHOME
is a great place to dump configuration files and local caches.To address these issues XDG Basedir was formed to give developers a standard location for these files (much like how
/
is well structured with/usr/share
,/var
and/etc
) and giving the users control over where they are placed in their HOME.If you were to support the XDG specification the following locations would change:
A basic patch might look something like this; although I'm not sure what
milkytracker_temp
is for. (Note: This was done long ago, I haven't invested much into milkytracker for the last year or more.)_(Edit: I noticed now that I don't correctly reset
home
togetenv("HOME");
if it fails to getXDG_CONFIG_HOME
, oops :P)_Thanks o/