import hashlib
import os
import pickle
-import shutil
-dired = f"{os.path.expanduser('~')}/.cache/lightcards/"
+xdg = os.environ.get("XDG_CACHE_HOME")
+if xdg:
+ dired = f"{os.path.expanduser('~')}/{xdg}/lightcards/"
+else:
+ dired = f"{os.path.expanduser('~')}/.cache/lightcards/"
def name_gen(stra):
def purge(stra):
"""Delete pickle file"""
- file = f"{dired}/{name_gen(stra)}/"
+ file = f"{dired}/{name_gen(stra)}.p"
if os.path.exists(file):
- shutil.rmtree(file)
+ os.remove(file)