-
-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Extension of #347
When working on a caching of cache directory between sessions on CI I found that I could easily overwrite the cache
directory location on Linux (using XDG_CACHE_DIR
)
Then I cannot overwrite it on macOS without overwriting the whole $HONE
.
platformdirs/src/platformdirs/macos.py
Lines 65 to 68 in c945a28
@property | |
def user_cache_dir(self) -> str: | |
""":return: cache directory tied to the user, e.g. ``~/Library/Caches/$appname/$version``""" | |
return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches")) # noqa: PTH111 |
It looks like there is an option to overwrite it on Windows:
platformdirs/src/platformdirs/windows.py
Lines 69 to 76 in c945a28
@property | |
def user_cache_dir(self) -> str: | |
""" | |
:return: cache directory tied to the user (if opinionated with ``Cache`` folder within ``$appname``) e.g. | |
``%USERPROFILE%\\AppData\\Local\\$appauthor\\$appname\\Cache\\$version`` | |
""" | |
path = os.path.normpath(get_win_folder("CSIDL_LOCAL_APPDATA")) | |
return self._append_parts(path, opinion_value="Cache") |
(will have access to a Windows machine in a few days, then could check)
But it will really simplify CI configuration if there is one environment variable respected on all OS. For example: PLATFORMDIR_CACHE_DIR
. (And similar variables for other directories)
What did you think about such a feature? Will you accept such a contribution?
Related PR that brings me this idea: napari/napari#8235