Make libdvdcss follow XDG on UNIX systems for folder path
Currently libdvdcss uses $HOME/.dvdcss as cache folder or $DVDCSS_CACHE.
Please make it follow the XDG Base Directory Specification [1]. This means placing dvdcss cache inside $XDG_CACHE_HOME folder with $XDG_CACHE_HOME as $HOME/.cache if unset.
The enclosed patch changes the cache folder to the following:
- $DVDCSS_CACHE
- $XDG_CACHE_HOME/dvdcss
- $HOME/.dvdcss (if existing)
- $HOME/.cache/dvdcss
It's basically XDG but keeping the old location in order not to waste whatever contents are already there (alternatively, it could be moved on first run). That fallback location could be removed in the future.
I gave $XDG_CACHE_HOME an higher priority considering that, as opposed to someone which is indifferent and just get everything at .cache for the default, if the user sets $XDG_CACHE_HOME it has a good reason and should be followed no matter if $HOME/.dvdcsss is there (eg. home is nfs mounted and $XDG_CACHE_HOME points to a local disk).
Patch attached. Best viewed with -w to skip the added indentation.
1 - http://standards.freedesktop.org/basedir-spec/latest/index.html