From cc9963418f4cfba00191c670bd3cb889ccc33097 Mon Sep 17 00:00:00 2001 From: jesterr0 Date: Sat, 12 Apr 2025 11:39:51 -0400 Subject: [PATCH] fix: building plugins on Windows where HOME isn't available sometimes --- maubot/cli/config.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/maubot/cli/config.py b/maubot/cli/config.py index 5fdc4ea..e25bc7e 100644 --- a/maubot/cli/config.py +++ b/maubot/cli/config.py @@ -26,7 +26,13 @@ config: dict[str, Any] = { "aliases": {}, "default_server": None, } -configdir = os.environ.get("XDG_CONFIG_HOME", os.path.join(os.environ.get("HOME"), ".config")) +home_dir = os.environ.get("HOME") or os.environ.get("USERPROFILE") +if home_dir is None: + raise EnvironmentError( + "Neither HOME nor USERPROFILE environment variables are set." + ) + +configdir = os.environ.get("XDG_CONFIG_HOME", os.path.join(home_dir, ".config")) def get_default_server() -> tuple[str | None, str | None]: