From d964711d81d1f1376132c6c6cf9ad55d174fab62 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 6 Dec 2023 07:34:22 +0000 Subject: [PATCH] Cope with lack of XDG config directories. If the host system is a pure server which you log into via ssh, it may not have these at all. Hard-code the default ~/.config as a fallback. --- login.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/login.py b/login.py index 279f28f..8ed54ea 100644 --- a/login.py +++ b/login.py @@ -4,7 +4,11 @@ import os import xdg def config_dir(): - return os.path.join(xdg.XDG_CONFIG_HOME, "mastodonochrome") + try: + config_home = xdg.XDG_CONFIG_HOME + except AttributeError: + config_home = os.path.join(os.environ["HOME"], ".config") + return os.path.join(config_home, "mastodonochrome") def config_file(): return os.path.join(config_dir(), "auth") -- 2.30.2