feat: 增加 Client Windows 打包基础 (#92)

This commit is contained in:
chengma
2026-08-10 11:59:13 +08:00
parent 3bfaf44799
commit 99252aecce
14 changed files with 470 additions and 22 deletions
+9 -1
View File
@@ -19,7 +19,15 @@ def data_dir() -> Path:
"""返回可写数据目录;目录不存在时自动创建。"""
if getattr(sys, "frozen", False):
directory = Path(sys.executable).resolve().parent / "data"
executable_directory = Path(sys.executable).resolve().parent
# 发布包结构是 Launcher.exe + app/CMAutoBuy.exe。主程序位于 app
# 目录时,data 必须放在上一层,升级替换 app 才不会覆盖本地数据库。
install_root = (
executable_directory.parent
if executable_directory.name.casefold() == "app"
else executable_directory
)
directory = install_root / "data"
else:
directory = Path(__file__).resolve().parents[1] / "data"
directory.mkdir(parents=True, exist_ok=True)
+6
View File
@@ -0,0 +1,6 @@
"""Client 的软件版本。
发布脚本和程序界面需要版本号时都从这里读取,避免多个文件各写一份。
"""
__version__ = "0.1.0"