Changed the temporary directory path to user's cache directory

This commit is contained in:
Deniz Şafak
2025-07-16 15:03:10 +03:00
parent 1f51e3edd3
commit 977b2a736c
5 changed files with 81 additions and 73 deletions
+12 -3
View File
@@ -74,14 +74,23 @@ def get_user_config_path():
if os.path.exists(custom_dir):
config_dir = custom_dir
else:
config_dir = user_config_dir("abogen", appauthor=False, roaming=True)
config_dir = user_config_dir("abogen", appauthor=False, roaming=True, ensure_exists=True)
else:
# Windows and fallback case
config_dir = user_config_dir("abogen", appauthor=False, roaming=True)
config_dir = user_config_dir("abogen", appauthor=False, roaming=True, ensure_exists=True)
os.makedirs(config_dir, exist_ok=True)
return os.path.join(config_dir, "config.json")
# Define cache path
def get_user_cache_path(folder=None):
from platformdirs import user_cache_dir
cache_dir = user_cache_dir("abogen", appauthor=False, opinion=True, ensure_exists=True)
if folder:
cache_dir = os.path.join(cache_dir, folder)
# Ensure the directory exists
os.makedirs(cache_dir, exist_ok=True)
return cache_dir
_sleep_procs = {"Darwin": None, "Linux": None} # Store sleep prevention processes