Make also compatible to pip package pyxdg

master
Felix Stupp 3 years ago
parent 3b7dfdc181
commit 723f578e8b
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -10,9 +10,15 @@ import time
# tries to follow XDG Base Directory Specification, if it fails due to a missing module, uses default cache dir ~/.cache
try:
# pip package: pyxdg
import xdg.BaseDirectory
CACHE_DIR = Path(xdg.BaseDirectory.xdg_cache_home)
except ModuleNotFoundError:
try:
# pip package: xdg
import xdg
CACHE_DIR = xdg.xdg_cache_home()
except ModuleNotFoundError:
except ModuleNotFoundError:
CACHE_DIR = Path.home() / ".cache"
GZIP_MAGIC_NUMBER = b'\x1f\x8b'

Loading…
Cancel
Save