from pathlib import Path
import os
def get_cache_path(app_name: str) -> Path:
"""Return the path for the app's cache directory, automatically adjusted for the OS.
Args:
app_name (str): The name of the application.
Returns:
Path: The absolute path to the app's cache directory.
"""
if os.name == 'nt': # Windows
cache_dir = Path(os.getenv('LOCALAPPDATA', Path.home())) / app_name / "Cache"
else:
cache_dir = Path.home() / ".cache" / app_name
if not cache_dir.exists():
cache_dir.mkdir(parents=True)
return cache_dir
# Example usage
cache_path = get_cache_path("my_app")
print(cache_path)
Sunday, 24 March 2024
Get cache-basepath in python: get_cache_path
Subscribe to:
Post Comments (Atom)
Iterative Mona Lisa E2E development
Iterative as at the beginning I know least Mona Lisa, as I always want to be able to stop E2E, go wide before going deep Notes: Agents are i...
-
""" This module processes Wikipedia dump files by extracting individual articles and parsing them into a structured format, ...
-
2 Million renderings took 0.875s import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap;...
-
docker pull quay.io/unstructured-io/unstructured-api 20gb image. After docker-pull: docker image inspect --format '{{json .}}' ...
No comments:
Post a Comment