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)
How whey is made
Source: https://www.youtube.com/watch?v=LeUZmojH7p8 Start with Milk, homogenize, pasteurize. It is 87% water, 5% lactose, 3.5% fat, 3.5...
-
""" 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