diff --git a/src/backend/backend.py b/src/backend/backend.py index a540326b..e4ea2362 100644 --- a/src/backend/backend.py +++ b/src/backend/backend.py @@ -430,11 +430,16 @@ class Backend: # General functions async def get_config_dir(self) -> Path: - return Path(self.appdirs.user_config_dir) + return Path( + os.environ.get("MOMENT_CONFIG_DIR") or + self.appdirs.user_config_dir, + ) async def get_theme_dir(self) -> Path: - path = Path(self.appdirs.user_data_dir) / "themes" + path = Path( + os.environ.get("MOMENT_DATA_DIR") or self.appdirs.user_data_dir, + ) / "themes" path.mkdir(parents=True, exist_ok=True) return path diff --git a/src/backend/matrix_client.py b/src/backend/matrix_client.py index 0541656f..49ee1836 100644 --- a/src/backend/matrix_client.py +++ b/src/backend/matrix_client.py @@ -165,7 +165,10 @@ class MatrixClient(nio.AsyncClient): device_id: Optional[str] = None, ) -> None: - store = Path(backend.appdirs.user_data_dir) / "encryption" + store = Path( + os.environ.get("MOMENT_DATA_DIR") or backend.appdirs.user_data_dir, + ) / "encryption" + store.mkdir(parents=True, exist_ok=True) proxy: Optional[str]