Repository navigation
fix(windows): embed icon in portable launcher stubs and make shortcut writes idempotent (#438) - #440
Merged
Merged
Conversation
… writes idempotent (#438)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #438
根因
0.5.12 起便携版使用新布局:官方文件在
app\下,根目录是 Manager 生成的启动器存根(Codex.exe/ChatGPT.exe/LaunchCodex.exe)。这个存根由裸rustc编译,没有任何图标资源;Windows 固定任务栏、或指向存根的快捷方式会显示成空白(白色)图标。另外 Manager 每次启动都会无条件重写Codex.lnk,手动修复会被覆盖。改动
assets/launcher.rc与assets/launcher.ico;build.rs在 Windows 目标上编译资源(MSVC 用rc.exe产出.res,GNU 用windres产出 COFF 对象),通过-C link-arg链接进存根,并加上rerun-if-changed。.camlnch段与启动逻辑不变。portable.rs):app\resources\icon-chatgpt.ico(存在才用)→app\ChatGPT.exe→ 启动器存根,不再回落到 Manager。portable_shortcut.rs):新增ShortcutSpec/read_spec/ensure/ensure_icon。先读再比较(路径用same_windows_path,参数、图标索引、AUMID 精确比较),一致则不写盘。create_manager_launch_shortcut改用ensure;create_start_menu_shortcut对已有的 Manager 链接只修图标,保留用户参数。测试
ensure幂等且不改写文件;ensure_icon只改图标、保留用户参数;图标选择顺序(含嵌套布局指向app\ChatGPT.exe);存根含RT_ICON/RT_GROUP_ICON(并入现有 launcher 往返测试)。cargo test -p codex-win-engine --lib114 通过。cargo check -p codex-win-engine --tests --target x86_64-pc-windows-gnu(mingw + windres)通过,且 build 脚本实际产出的存根.rsrc含图标资源。未验证
assert_launcher_has_no_vc_runtime_import)只做了交叉编译检查,未在 Windows 上运行,依赖 CI。rc.exe)未在本地跑过,依赖 Windows CI。launcher.ico暂用src-tauri/icons/icon.ico(Manager 图标);如需官方图标请替换该文件。cargo fmt/clippy(box 上未装组件)。