update default cache directory ... again

Use a 'gallery-dl' subdirectory in ~/.cache to adhere to how other
programs store their cached data, and call os.makedirs() so it also
works without an existing ~/.cache directory.
This commit is contained in:
Mike Fährmann
2019-08-01 21:47:13 +02:00
parent 4a0c98bfc9
commit 0609afd1e4
2 changed files with 6 additions and 6 deletions

View File

@@ -194,12 +194,12 @@ def _path():
if os.name == "nt":
import tempfile
cachedir = tempfile.gettempdir()
else:
cachedir = util.expand_path(
os.environ.get("XDG_CACHE_HOME", "~/.cache"))
return os.path.join(tempfile.gettempdir(), ".gallery-dl.cache")
return os.path.join(cachedir, ".gallery-dl.cache")
cachedir = util.expand_path(os.path.join(
os.environ.get("XDG_CACHE_HOME", "~/.cache"), "gallery-dl"))
os.makedirs(cachedir, exist_ok=True)
return os.path.join(cachedir, "cache.sqlite3")
try: