From 294ef80c80c9730d2bc399b404c5dc9748c5223e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Ri=C3=9Fe?= Date: Tue, 7 May 2024 15:07:52 +0200 Subject: [PATCH] Fix creation logic for MSUI_CONFIG_PATH --- mslib/msui/constants.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/mslib/msui/constants.py b/mslib/msui/constants.py index fd4315081..9e3555d16 100644 --- a/mslib/msui/constants.py +++ b/mslib/msui/constants.py @@ -34,17 +34,8 @@ # ToDo refactor to generic functions, keep only constants HOME = os.path.expanduser(f"~{os.path.sep}") MSUI_CONFIG_PATH = os.getenv("MSUI_CONFIG_PATH", os.path.join(HOME, ".config", "msui")) -if '://' in MSUI_CONFIG_PATH: - try: - _fs = fs.open_fs(MSUI_CONFIG_PATH) - except fs.errors.CreateFailed: - _fs.makedirs(MSUI_CONFIG_PATH) - except fs.opener.errors.UnsupportedProtocol: - logging.error('FS url "%s" not supported', MSUI_CONFIG_PATH) -else: - _dir = os.path.expanduser(MSUI_CONFIG_PATH) - if not os.path.exists(_dir): - os.makedirs(_dir) +# Make sure that MSUI_CONFIG_PATH exists +_ = fs.open_fs(MSUI_CONFIG_PATH, create=True) GRAVATAR_DIR_PATH = fs.path.join(MSUI_CONFIG_PATH, "gravatars")