Currently there are already two functions for creating the $XDG_CONFIG_HOME and $XDG_DATA_HOME directories: xdg.BaseDirectory.save_config_path(*resource) and xdg.BaseDirectory.save_data_path(*resource).
However, despite that fact that people often purge their cache and the fact that the cache should be easy to use as well there is no xdg.BaseDirectory.save_cache_path() function.
I would suggest to add one to make the life of the developers easier.
The function would like this:
"""Ensure $XDG_CACHE_HOME/<resource>/ exists, and return its path.
'resource' is the name of some shared resource. Use this when updating
a shared (between programs) database. Use the xdg_cache_home variable
resource = os.path.join(*resource)
assert not resource.startswith('/')
path = os.path.join(xdg_cache_home, resource)
if not os.path.isdir(path):
Created attachment 33131 [details] [review]
Add a xdg.BaseDirectory.save_cache_path() function
Thanks, I've added that with a test.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct.