Skip to content

补上 Linux 源码运行入口,修复几处路径问题#15

Merged
RachelForster merged 4 commits into
RachelForster:mainfrom
molang163:linux-support-mvp
May 23, 2026
Merged

补上 Linux 源码运行入口,修复几处路径问题#15
RachelForster merged 4 commits into
RachelForster:mainfrom
molang163:linux-support-mvp

Conversation

@molang163
Copy link
Copy Markdown
Contributor

@molang163 molang163 commented May 18, 2026

这次先补一个比较基础的 Linux 运行入口,目标是让项目在源码检出后可以直接创建虚拟环境并启动 Qt UI,不需要先走打包流程。

主要改动:

  • 增加 install-linux.shstart-linux.sh
  • .env.local 只按 KEY=VALUE 读取,不再当作 shell 脚本执行
  • 忽略 .env.venv.uv-cache 等本地文件,并提供 .env.local.example
  • 启动日志里的 API key 做脱敏处理
  • 安装和启动时补齐需要的 data 子目录
  • TTS 缓存路径改成 cache/audio,避免 Windows 反斜杠路径在 Linux 下出问题
  • 导入角色包/背景包时兼容 Windows 路径分隔符,并拒绝绝对路径、盘符路径、.. 和不安全的 zip 成员路径

这不是完整的 Linux packaging,也没有新增模型 provider 或 CUDA 自动配置。这个 PR 只先处理源码运行和跨平台路径这几块基础问题。

验证过:

  • bash -n install-linux.sh start-linux.sh
  • python -m py_compile tools/file_util.py main.py tts/tts_manager.py
  • git diff --check
  • .env.local 会被 git 忽略
  • 路径和 zip 成员的安全校验脚本测试通过

@molang163 molang163 force-pushed the linux-support-mvp branch from 99cd65a to 60a7ae0 Compare May 18, 2026 01:01
@molang163 molang163 changed the title Add basic Linux source-checkout startup path 添加 Linux 源码检出运行入口 May 18, 2026
@molang163 molang163 changed the title 添加 Linux 源码检出运行入口 补上 Linux 源码运行入口,修复几处路径问题 May 18, 2026
@molang163
Copy link
Copy Markdown
Contributor Author

molang163 commented May 18, 2026

并非“佬”。

README 里的 conda 流程确实能跑,这个 PR 主要不是想替代那套流程,而是把 Linux 下源码运行时顺手踩到的几个小坑补一下,比如启动脚本、路径兼容、data 目录初始化,以及 .env.local 读取 / API key 日志脱敏这些细节。这样后面有人在 Linux 上试的时候,可以少手动处理一点。

@molang163 molang163 force-pushed the linux-support-mvp branch from 4b4cf87 to d0d9d7d Compare May 18, 2026 04:47
@molang163
Copy link
Copy Markdown
Contributor Author

确实,这两个点我之前没处理完整,已经补了一版。

  • install-linux.sh / start-linux.sh 现在会优先使用已激活的非 base Python 3.10 conda 环境;否则安装脚本走 uv 创建 .venv;没有 uv 时只接受系统 python3.10,不再静默使用任意 python3。
  • README 中英文也补了 Linux 脚本和 conda 流程的关系说明。
  • background 包这里也改了:导出 .bg 时会把 sprites[].path / bgm_list 写成包内文件名,不再保存宿主机绝对路径;导入时仍保留路径安全检查,同时兼容旧包里保存的绝对路径,只取 basename 后重建到 data/backgrounds 和 data/bgm。
  • 另外补了 background import/export 的回归测试。

本地验证过 bash -n、py_compile、git diff --check,以及 .bg 导出/导入的临时回归脚本。

@RachelForster
Copy link
Copy Markdown
Owner

另外请修复一下挂掉的test,谢谢!

@molang163 molang163 force-pushed the linux-support-mvp branch from f7c63f5 to 011cc70 Compare May 19, 2026 17:18
@molang163
Copy link
Copy Markdown
Contributor Author

已修复

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请添加兼容性测试,确保老版本导出的依然能被新版本正确导入,感谢。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已把这个用例明确成 legacy export 兼容性测试了:会构造旧 .bg 里保存宿主绝对路径的情况,并确认新版本导入时能按文件名恢复到当前项目的 data/backgrounds / data/bgm 下。

Comment thread scripts/start-linux.sh
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

能把这两个脚本移动到scripts下吗,我release的时候会把这两个脚本给移动出来,再把.bat文件删除,scripts里也有macos版本的安装启动脚本。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已移到 scripts/install-linux.shscripts/start-linux.sh 了,也同步改了中英文 README 里的 Linux 命令。脚本内部会先切回项目根目录再执行。

@RachelForster RachelForster merged commit dc78354 into RachelForster:main May 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants