From 19007edcd7aa98ca77a39abb197b3ad917f9c785 Mon Sep 17 00:00:00 2001 From: Lionel Dricot Date: Tue, 1 Feb 2022 11:22:52 +0100 Subject: [PATCH] =?UTF-8?q?close=20#6=20(please=20test).=20It=20seems=20th?= =?UTF-8?q?ere=20are=20two=20XDG=20modules=20out=20there=20which=20are=20b?= =?UTF-8?q?oth=20incompatibles.=20The=20one=20is=20Debian=20seems=20to=20b?= =?UTF-8?q?e=20a=20mix=20of=20both=20so=20I=20migrated=20to=20the=20correc?= =?UTF-8?q?t=20way=20of=20using=20it=20(thanks=20to=20Klaus=20Alexander=20?= =?UTF-8?q?for=20providing=20code=20example).=20If=20this=20doesn=E2=80=99?= =?UTF-8?q?t=20work=20for=20everyone,=20we=20will=20have=20to=20support=20?= =?UTF-8?q?both=20way=20(code=20also=20provided=20by=20Klaus=20Alexander)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- offpunk.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/offpunk.py b/offpunk.py index a1122f5..215314f 100755 --- a/offpunk.py +++ b/offpunk.py @@ -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