]> git.armaanb.net Git - lightcards.git/blobdiff - lightcards/progress.py
Add menu keybindings to config
[lightcards.git] / lightcards / progress.py
index 3be0247e42170c3243cf03814dc09b51b0ab38bc..a4fdc43b267b687e984210b1e7670c4f2dfacf23 100644 (file)
@@ -4,9 +4,12 @@
 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):
@@ -39,6 +42,6 @@ def dive(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)