Skip to content

Commit

Permalink
Fix creation logic for MSUI_CONFIG_PATH (#2343)
Browse files Browse the repository at this point in the history
  • Loading branch information
matrss authored May 8, 2024
1 parent 8b5c734 commit 7d66e32
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions mslib/msui/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 7d66e32

Please sign in to comment.