diff --git a/relay/config.py b/relay/config.py index 5aadcec..937372f 100644 --- a/relay/config.py +++ b/relay/config.py @@ -57,6 +57,9 @@ class Config: @property def sqlite_path(self) -> Path: + if not os.path.isabs(self.sq_path): + return self.path.parent.joinpath(self.sq_path).resolve() + return Path(self.sq_path).expanduser().resolve() diff --git a/relay/database/__init__.py b/relay/database/__init__.py index d69b214..925c5e0 100644 --- a/relay/database/__init__.py +++ b/relay/database/__init__.py @@ -18,7 +18,7 @@ if typing.TYPE_CHECKING: def get_database(config: Config, migrate: Optional[bool] = True) -> tinysql.Database: if config.db_type == "sqlite": - db = tinysql.Database.sqlite(config.sq_path, connection_class = Connection) + db = tinysql.Database.sqlite(config.sqlite_path, connection_class = Connection) elif config.db_type == "postgres": db = tinysql.Database.postgres(