保证文件夹存在

pull/50/head
UnCLAS-Prommer 2025-07-06 12:14:04 +08:00
parent 883b2934d2
commit 5dd2dda067
1 changed files with 1 additions and 0 deletions

View File

@ -49,6 +49,7 @@ class DatabaseManager:
"""
def __init__(self):
os.mkdir(os.path.join(os.path.dirname(__file__), "..", "data"), exist_ok=True) # 确保数据目录存在
DATABASE_FILE = os.path.join(os.path.dirname(__file__), "..", "data", "NapcatAdapter.db")
self.sqlite_url = f"sqlite:///{DATABASE_FILE}" # SQLite 数据库 URL
self.engine = create_engine(self.sqlite_url, echo=False) # 创建数据库引擎