Browse code

add ~/.cache/freewvs/ dir option and enforce order of freewvsdb dirs

Hanno Böck authored on23/12/2019 12:39:03
Showing1 changed files
... ...
@@ -29,6 +29,7 @@ import re
29 29
 import argparse
30 30
 import sys
31 31
 import json
32
+import pathlib
32 33
 from xml.sax.saxutils import escape
33 34
 
34 35
 
... ...
@@ -80,9 +81,11 @@ for d in ["/usr/share/freewvs", "/usr/local/share/freewvs"]:
80 81
               file=sys.stderr)
81 82
 
82 83
 jdir = False
83
-for p in [os.path.dirname(sys.argv[0]) + '/freewvsdb', '/var/lib/freewvs']:
84
+for p in [os.path.dirname(sys.argv[0]) + '/freewvsdb', '/var/lib/freewvs',
85
+          str(pathlib.Path.home()) + "/.cache/freewvs/"]:
84 86
     if os.path.isdir(p):
85 87
         jdir = p
88
+        break
86 89
 if not jdir:
87 90
     print("Can't find freewvs json db")
88 91
     sys.exit(1)