close #6 (please test). It seems there are two XDG modules out there which are both incompatibles. The one is Debian seems to be a mix of both so I migrated to the correct way of using it (thanks to Klaus Alexander for providing code example). If this doesn’t work for everyone, we will have to support both way (code also provided by Klaus Alexander)

This commit is contained in:
Lionel Dricot 2022-02-01 11:22:52 +01:00
parent 6b0c362b5e
commit 19007edcd7
1 changed files with 5 additions and 4 deletions

View File

@ -83,11 +83,12 @@ except ModuleNotFoundError:
_VERSION = "0.2"
## Config directories
# There are two conflicting xdg modules, we try to work with both
try:
import xdg
_CACHE_PATH = os.path.join(xdg.xdg_cache_home().resolve(), "offpunk/")
_CONFIG_DIR = os.path.join(xdg.xdg_config_home().resolve(), "offpunk/")
_DATA_DIR = os.path.join(xdg.xdg_data_home().resolve(), "offpunk/")
from xdg import BaseDirectory
_CACHE_PATH = BaseDirectory.save_cache_path("offpunk")
_CONFIG_DIR = BaseDirectory.save_config_path("offpunk")
_DATA_DIR = BaseDirectory.save_data_path("offpunk")
except ModuleNotFoundError:
_CACHE_PATH = os.path.expanduser("~/.cache/offpunk/")
_CONFIG_DIR = None