feat: store packaged user data under data directory

This commit is contained in:
chengma
2026-07-07 14:12:32 +08:00
parent caa04a9aa7
commit 148c4a73eb
33 changed files with 602 additions and 196 deletions
+12
View File
@@ -5,6 +5,7 @@ from __future__ import annotations
import os
import sys
from .. import appconfig
from . import widgets as _widgets
from .widgets import *
@@ -46,6 +47,17 @@ def main() -> int:
return 1
_ensure_offscreen_for_headless_tests()
app = QApplication.instance() or QApplication(sys.argv)
try:
appconfig.prepare_data_dir()
except appconfig.DataMigrationConflictError as exc:
QMessageBox.critical(None, "数据迁移冲突", str(exc))
return 1
except appconfig.DataDirectoryWriteError as exc:
QMessageBox.critical(None, "数据目录不可写", str(exc))
return 1
except appconfig.ConfigError as exc:
QMessageBox.critical(None, "启动配置错误", str(exc))
return 1
window = MainWindow()
window.show()
return app.exec()