Add UIOP/CONFIGURE:XDG-STATE-HOME
According to the XDG basedir-spec v0.8:
There is a single base directory relative to which user-specific state data should be written. This directory is defined by the environment variable $XDG_STATE_HOME.
$XDG_STATE_HOME defines the base directory relative to which user-specific state files should be stored. If $XDG_STATE_HOME is either not set or empty, a default equal to $HOME/.local/state should be used.
The $XDG_STATE_HOME contains state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in $XDG_DATA_HOME. It may contain:
actions history (logs, history, recently used files, …)
current state of the application that can be reused on a restart (view, layout, open files, undo history, …)
XDG_STATE_HOME
is the only base directory that ASDF/CONFIGURE does not implement. I think it ought to be straightforward:
(defun xdg-state-home (&rest more)
"The base directory relative to which user specific state files should be saved.
Returns an absolute directory pathname.
MORE may contain specifications for a subpath relative to this directory: a
subpathname specification and keyword arguments as per RESOLVE-LOCATION \(see
also \"Configuration DSL\"\) in the ASDF manual."
(resolve-absolute-location
`(,(or (getenv-absolute-directory "XDG_STATE_HOME")
(os-cond
((os-windows-p) (xdg-data-home "state/"))
(t (subpathname* (user-homedir-pathname) ".local/state/"))))
,more)))
I'm open to feedback on this. The only problem running through my head is that introducing a new symbol to UIOP/CONFIGURE has the potential to break systems :use
ing this package, though I don't know ASDF's policy on this.