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, ...
-
""" 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;...
-
Der Kollektivgeist: Ihr intelligentes Unternehmensgedächtnis Wissen aus den Köpfen der Mitarbeiter extrahieren - Die ...
No comments:
Post a Comment