From: Perry Vargas Date: Sat, 22 Jan 2022 06:00:33 +0000 (-0800) Subject: Allow setting custom cache directory on all platforms (#2739) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/10677baa40f818ca06c6a9d5efa0dca052865bfb?ds=sidebyside;hp=10677baa40f818ca06c6a9d5efa0dca052865bfb Allow setting custom cache directory on all platforms (#2739) Fixes #2506 ``XDG_CACHE_HOME`` does not work on Windows. To allow for users to set a custom cache directory on all systems I added a new environment variable ``BLACK_CACHE_DIR`` to set the cache directory. The default remains the same so users will only notice a change if that environment variable is set. The specific use case I have for this is I need to run black on in different processes at the same time. There is a race condition with the cache pickle file that made this rather difficult. A custom cache directory will remove the race condition. I created ``get_cache_dir`` function in order to test the logic. This is only used to set the ``CACHE_DIR`` constant. ---