Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ jobs:
test -f "$app/Contents/Info.plist"
test -f "$app/Contents/PkgInfo"
test -x "$app/Contents/MacOS/$(/usr/libexec/PlistBuddy -c 'Print :CFBundleExecutable' "$app/Contents/Info.plist")"
icon="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIconFile' "$app/Contents/Info.plist")"
test -f "$app/Contents/Resources/$icon"
plutil -lint "$app/Contents/Info.plist" >/dev/null
codesign -dv "$app" >/dev/null 2>&1
echo "verified: $app"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ jobs:
test -f "$app/Contents/Info.plist"
test -f "$app/Contents/PkgInfo"
test -x "$app/Contents/MacOS/$(/usr/libexec/PlistBuddy -c 'Print :CFBundleExecutable' "$app/Contents/Info.plist")"
icon="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIconFile' "$app/Contents/Info.plist")"
test -f "$app/Contents/Resources/$icon"
plutil -lint "$app/Contents/Info.plist" >/dev/null
codesign -dv "$app" >/dev/null 2>&1
echo "verified: $app"
Expand Down
22 changes: 15 additions & 7 deletions crates/codex-plus-core/src/install/macos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,20 @@ fn write_bundle(bundle: &MacosAppBundle) -> anyhow::Result<()> {

#[cfg(target_os = "macos")]
fn copy_icon(resources: &Path) -> anyhow::Result<()> {
let source = std::env::current_exe()
.ok()
.and_then(|path| path.parent().map(Path::to_path_buf))
.map(|path| path.join("codex-plus-plus.png"));
if let Some(source) = source.filter(|path| path.exists()) {
fs::copy(source, resources.join("codex-plus-plus.png"))?;
let source = std::env::current_exe().ok().and_then(|executable| {
let macos = executable.parent()?;
let contents = macos.parent()?;
let bundled_icon = contents.join("Resources/codex-plus-plus.icns");
bundled_icon.exists().then_some(bundled_icon).or_else(|| {
let sidecar_icon = macos.join("codex-plus-plus.icns");
sidecar_icon.exists().then_some(sidecar_icon)
})
});
if let Some(source) = source {
let target = resources.join("codex-plus-plus.icns");
if source != target {
fs::copy(source, target)?;
}
}
Ok(())
}
Expand Down Expand Up @@ -178,7 +186,7 @@ fn info_plist(display_name: &str, executable_name: &str, identifier_suffix: &str
<key>CFBundleExecutable</key>
<string>{executable_name}</string>
<key>CFBundleIconFile</key>
<string>codex-plus-plus.png</string>
<string>codex-plus-plus.icns</string>
<key>LSUIElement</key>
<true/>
<key>LSMinimumSystemVersion</key>
Expand Down
12 changes: 12 additions & 0 deletions crates/codex-plus-core/tests/installers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ fn macos_bundle_metadata_contains_silent_and_manager_apps() {
.info_plist
.contains("<string>Codex++ 管理工具</string>")
);
assert!(
silent
.info_plist
.contains("<string>codex-plus-plus.icns</string>")
);
assert!(
manager
.info_plist
.contains("<string>codex-plus-plus.icns</string>")
);
assert!(!silent.info_plist.contains("codex-plus-plus.png"));
assert!(!manager.info_plist.contains("codex-plus-plus.png"));
assert_eq!(
silent.binary_target_name.as_deref(),
Some("codex-plus-plus")
Expand Down