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:
@@ -1493,7 +1493,7 @@ cache.file
|
|||||||
=========== =====
|
=========== =====
|
||||||
Type |Path|_
|
Type |Path|_
|
||||||
Default * |tempfile.gettempdir()|_ + ``".gallery-dl.cache"`` on Windows
|
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,
|
Description Path of the SQLite3 database used to cache login sessions,
|
||||||
cookies and API tokens across `gallery-dl` invocations.
|
cookies and API tokens across `gallery-dl` invocations.
|
||||||
|
|
||||||
|
|||||||
@@ -194,12 +194,12 @@ def _path():
|
|||||||
|
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
import tempfile
|
import tempfile
|
||||||
cachedir = tempfile.gettempdir()
|
return os.path.join(tempfile.gettempdir(), ".gallery-dl.cache")
|
||||||
else:
|
|
||||||
cachedir = util.expand_path(
|
|
||||||
os.environ.get("XDG_CACHE_HOME", "~/.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:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user