Skip to content

Commit 1069c5d

Browse files
committed
chore: use user cache folder for everything
this folder is more fitting since we don't store any important data
1 parent 0011a80 commit 1069c5d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

pytailwindcss_extra/main.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from time import time
1010
from typing import Generator
1111
from datetime import datetime, timedelta
12-
from platformdirs import user_data_dir
1312

13+
from platformdirs import user_cache_dir
1414
import niquests
1515
from tqdm import tqdm
1616

@@ -23,9 +23,9 @@
2323

2424

2525
def main() -> int:
26-
bin_dir_path = Path(user_data_dir("pytailwindcss-extra")) / "bin"
26+
bin_dir_path = Path(user_cache_dir("pytailwindcss-extra")) / "bin"
2727

28-
cache_file_path = Path(gettempdir()) / "tailwindcss-extra-cache.json"
28+
cache_file_path = Path(user_cache_dir("pytailwindcss-extra")) / "versions.json"
2929
version = get_version(environ.get("PYTAILWINDCSS_EXTRA_VERSION", "major"), cache_file_path)
3030

3131
bin_path = bin_dir_path / f"tailwindcss-extra-{version.replace('.', '-')}"
@@ -77,6 +77,7 @@ def get_cached_version(key: str, cache_file_path: Path) -> str | None:
7777

7878
def set_cached_version(key: str, version: str, cache_file_path: Path) -> None:
7979
if not cache_file_path.exists():
80+
cache_file_path.parent.mkdir(parents=True, exist_ok=True)
8081
with cache_file_path.open("w") as file:
8182
file.write("{}")
8283

0 commit comments

Comments
 (0)