Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 修复 macOS 更新包定位兼容性

DavidShen63bcd413370d
diff --git a/apps/desktop/src/main/__tests__/updateScriptMacOS.test.ts b/apps/desktop/src/main/__tests__/updateScriptMacOS.test.ts
index 94b621f365..f307b51b0d 100644
--- a/apps/desktop/src/main/__tests__/updateScriptMacOS.test.ts
+++ b/apps/desktop/src/main/__tests__/updateScriptMacOS.test.ts
@@ -106,6 +106,12 @@ describe('buildMacOSUpdateScript structure', () => {
expect(script).toContain('] && [ "$OPEN_EXIT" -ne 0 ]; then');
});
+ it('finds the top-level app bundle without GNU-only find options', () => {
+ expect(script).toContain('for candidate in "/tmp/xdt-maker-update-1"/*.app; do');
+ expect(script).toContain('if [ -d "$candidate" ]; then');
+ expect(script).not.toContain('-maxdepth');
+ });
+
it('marks update-launched candidates so the app can recover presentation after unlock', () => {
const openLines = script.split('\n').filter((line) => /^\s*open /.test(line));
expect(openLines).toHaveLength(2);
diff --git a/apps/desktop/src/main/updateScriptMacOS.ts b/apps/desktop/src/main/updateScriptMacOS.ts
index 1bc210a65a..335cb4dd49 100644
--- a/apps/desktop/src/main/updateScriptMacOS.ts
+++ b/apps/desktop/src/main/updateScriptMacOS.ts
@@ -113,7 +113,16 @@ export function buildMacOSUpdateScript(params: MacUpdateScriptParams): string {
' exit 1',
'fi',
'',
- `NEW_APP=$(find "${extractDir}" -name "*.app" -maxdepth 1 | head -1)`,
+ // macOS ships BSD find, which has no GNU -maxdepth option. A shell glob
+ // keeps the search top-level, works with spaces in bundle paths, and is
+ // available in the Bash used to run this detached script.
+ 'NEW_APP=""',
+ `for candidate in "${extractDir}"/*.app; do`,
+ ' if [ -d "$candidate" ]; then',
+ ' NEW_APP="$candidate"',
+ ' break',
+ ' fi',
+ 'done',
'if [ -z "$NEW_APP" ]; then',
` echo "[$(date)] FATAL: no .app found in ${extractDir} — zip layout unexpected" >> "${logPath}"`,
` rm -f "${lockFilePath}"`,