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

Loading…
Cancel
Save