Last active
November 2, 2023 13:48
Revisions
-
mosquito revised this gist
Nov 2, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ def get_cache_dir(*suffix) -> Path: cache_path = CACHE_PATH.expanduser().resolve() if suffix: cache_path = cache_path.joinpath(*suffix) cache_path.mkdir(exist_ok=True, parents=True) -
mosquito created this gist
Nov 2, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ import platform from pathlib import Path match platform.system(): case 'Linux': CACHE_PATH = Path(os.getenv("XDG_CACHE_HOME", '~/.cache')) case 'Darwin': CACHE_PATH = Path('~') / 'Library' / 'Caches' case 'Windows': CACHE_PATH = Path('~') / 'AppData' / 'Local' case _: CACHE_PATH = Path(tempfile.gettempdir()) / "cache" def get_cache_dir(*suffix) -> Path: cache_path = CACHE_PATH.expanduser().expanduser().resolve() if suffix: cache_path = cache_path.joinpath(*suffix) cache_path.mkdir(exist_ok=True, parents=True) return cache_path