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.
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")