diff --git a/src/pyconify/_cache.py b/src/pyconify/_cache.py index 8188f01..b4f13d6 100644 --- a/src/pyconify/_cache.py +++ b/src/pyconify/_cache.py @@ -32,11 +32,8 @@ def get_cache_directory(app_name: str = "pyconify") -> Path: if os.name == "posix": return Path.home() / ".cache" / app_name elif os.name == "nt": - if local_app_data := os.environ.get("LOCALAPPDATA"): - return Path(local_app_data) / app_name # pragma: no cover - app_data_path = Path("~/AppData/Local").expanduser() - if app_data_path.exists(): - return app_data_path / app_name + appdata = os.environ.get("LOCALAPPDATA", "~/AppData/Local") + return Path(appdata).expanduser() / app_name # Fallback to a directory in the user's home directory return Path.home() / f".{app_name}" # pragma: no cover