summaryrefslogtreecommitdiff
path: root/lib/utils
diff options
context:
space:
mode:
authorBenson Muite <bkmgit@users.noreply.github.com>2025-03-04 11:17:22 +0300
committerGitHub <noreply@github.com>2025-03-04 09:17:22 +0100
commitbef98ef4ebb5af247f349e32f55a6648bf9dbceb (patch)
treef6c38a1ab23e4100d89c9cb447ddc8ae69400c7d /lib/utils
parent097451eb8b5808d31898d1f855cdea656469d1d0 (diff)
Migrate from appdirs to platformdirs (#3449) (#3450)
Diffstat (limited to 'lib/utils')
-rw-r--r--lib/utils/cache.py6
-rwxr-xr-xlib/utils/paths.py4
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/utils/cache.py b/lib/utils/cache.py
index 978782bf..76ce2416 100644
--- a/lib/utils/cache.py
+++ b/lib/utils/cache.py
@@ -8,7 +8,7 @@ import os
import pickle
import sqlite3
-import appdirs
+import platformdirs
import diskcache
from lib.utils.settings import global_settings
@@ -31,13 +31,13 @@ def get_stitch_plan_cache():
global __stitch_plan_cache
if __stitch_plan_cache is None:
- cache_dir = os.path.join(appdirs.user_config_dir('inkstitch'), 'cache', 'stitch_plan')
+ cache_dir = os.path.join(platformdirs.user_config_dir('inkstitch'), 'cache', 'stitch_plan')
size_limit = global_settings['cache_size'] * 1024 * 1024
try:
__stitch_plan_cache = diskcache.Cache(cache_dir, size=size_limit)
except (sqlite3.DatabaseError, sqlite3.OperationalError):
# reset cache database file if it couldn't parse correctly
- cache_file = os.path.join(appdirs.user_config_dir('inkstitch'), 'cache', 'stitch_plan', 'cache.db')
+ cache_file = os.path.join(platformdirs.user_config_dir('inkstitch'), 'cache', 'stitch_plan', 'cache.db')
if os.path.exists(cache_file):
os.remove(cache_file)
__stitch_plan_cache = diskcache.Cache(cache_dir, size=size_limit)
diff --git a/lib/utils/paths.py b/lib/utils/paths.py
index c9d7b046..6eafbd77 100755
--- a/lib/utils/paths.py
+++ b/lib/utils/paths.py
@@ -8,7 +8,7 @@ import sys
from os.path import dirname, realpath
from pathlib import Path
-import appdirs
+import platformdirs
if sys.version_info >= (3, 11):
import tomllib # built-in in Python 3.11+
@@ -42,7 +42,7 @@ def get_resource_dir(name):
def get_user_dir(name=None):
- path = appdirs.user_config_dir("inkstitch")
+ path = platformdirs.user_config_dir("inkstitch")
if name is not None:
path = os.path.join(path, name)