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: def save_cache_path(*resource): """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 for loading.""" resource = os.path.join(*resource) assert not resource.startswith('/') path = os.path.join(xdg_cache_home, resource) if not os.path.isdir(path): os.makedirs(path) return path
Created attachment 33131 [details] [review] Add a xdg.BaseDirectory.save_cache_path() function
Thanks, I've added that with a test. http://cgit.freedesktop.org/xdg/pyxdg/commit/?id=225e9885c85215beb162994e886ee6d528a91998
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.