mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-30 22:54:14 +00:00 
			
		
		
		
	Use XDG_CACHE_HOME for cache
This commit is contained in:
		| @@ -185,7 +185,18 @@ def cache(*depends_on): | ||||
|         if cache.disabled: | ||||
|             return fn(*args, **kwargs) | ||||
|  | ||||
|         cache_path = settings.user_dir.joinpath('.thefuck-cache').as_posix() | ||||
|         default_xdg_cache_dir = os.path.expanduser("~/.cache") | ||||
|         cache_dir = os.getenv("XDG_CACHE_HOME", default_xdg_cache_dir) | ||||
|         cache_path = Path(cache_dir).joinpath('thefuck').as_posix() | ||||
|  | ||||
|         # Ensure the cache_path exists, Python 2 does not have the exist_ok | ||||
|         # parameter | ||||
|         try: | ||||
|             os.makedirs(cache_dir) | ||||
|         except OSError: | ||||
|             if not os.path.isdir(cache_dir): | ||||
|                 raise | ||||
|  | ||||
|         # A bit obscure, but simplest way to generate unique key for | ||||
|         # functions and methods in python 2 and 3: | ||||
|         key = '{}.{}'.format(fn.__module__, repr(fn).split('at')[0]) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user