Skip to content

Commit 7d66e32

Browse files
authored
Fix creation logic for MSUI_CONFIG_PATH (#2343)
1 parent 8b5c734 commit 7d66e32

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

mslib/msui/constants.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,8 @@
3434
# ToDo refactor to generic functions, keep only constants
3535
HOME = os.path.expanduser(f"~{os.path.sep}")
3636
MSUI_CONFIG_PATH = os.getenv("MSUI_CONFIG_PATH", os.path.join(HOME, ".config", "msui"))
37-
if '://' in MSUI_CONFIG_PATH:
38-
try:
39-
_fs = fs.open_fs(MSUI_CONFIG_PATH)
40-
except fs.errors.CreateFailed:
41-
_fs.makedirs(MSUI_CONFIG_PATH)
42-
except fs.opener.errors.UnsupportedProtocol:
43-
logging.error('FS url "%s" not supported', MSUI_CONFIG_PATH)
44-
else:
45-
_dir = os.path.expanduser(MSUI_CONFIG_PATH)
46-
if not os.path.exists(_dir):
47-
os.makedirs(_dir)
37+
# Make sure that MSUI_CONFIG_PATH exists
38+
_ = fs.open_fs(MSUI_CONFIG_PATH, create=True)
4839

4940
GRAVATAR_DIR_PATH = fs.path.join(MSUI_CONFIG_PATH, "gravatars")
5041

0 commit comments

Comments
 (0)