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.
pull/373/head
Mike Fährmann 5 years ago
parent 4a0c98bfc9
commit 0609afd1e4
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -1493,7 +1493,7 @@ cache.file
=========== =====
Type |Path|_
Default * |tempfile.gettempdir()|_ + ``".gallery-dl.cache"`` on Windows
* (``$XDG_CACHE_HOME`` or ``"~/.cache"``) + ``".gallery-dl.cache"`` on all other platforms
* (``$XDG_CACHE_HOME`` or ``"~/.cache"``) + ``"/gallery-dl/cache.sqlite3"`` on all other platforms
Description Path of the SQLite3 database used to cache login sessions,
cookies and API tokens across `gallery-dl` invocations.

@ -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:

Loading…
Cancel
Save