Skip to content

Commit

Permalink
Use local app data for cache on windows
Browse files Browse the repository at this point in the history
APPDATA env variable resolves to the Roaming appdata directory which is
meant to be synced to other machines. Instead use the LOCALAPPDATA which
resolves to the Local appdata directory meant for temporary cache files.

Additionally, the 'cache' subdirectory does not seem to be required.
  • Loading branch information
ihabunek committed Sep 8, 2024
1 parent 2eb8fa8 commit 170298e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions twitchdl/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def _cache_dir_path() -> Path:
"""Returns the path to the cache directory"""

# Windows
if sys.platform == "win32" and "APPDATA" in os.environ:
return Path(os.environ["APPDATA"], CACHE_SUBFOLDER, "cache")
if sys.platform == "win32" and "LOCALAPPDATA" in os.environ:
return Path(os.environ["LOCALAPPDATA"], CACHE_SUBFOLDER)

# Mac OS
if sys.platform == "darwin":
Expand Down

0 comments on commit 170298e

Please sign in to comment.