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)
Parse Wikipedia dump
""" This module processes Wikipedia dump files by extracting individual articles and parsing them into a structured format, ...
-
Der Kollektivgeist: Ihr intelligentes Unternehmensgedächtnis Wissen aus den Köpfen der Mitarbeiter extrahieren - Die ...
-
docker pull quay.io/unstructured-io/unstructured-api 20gb image. After docker-pull: docker image inspect --format '{{json .}}' ...
No comments:
Post a Comment