Skip to content
Draft
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
4 changes: 4 additions & 0 deletions packages/installer/src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ function isWinCodexRoot(appRoot: string): boolean {

function findWinExecutable(appRoot: string): string {
try {
// Newer Microsoft Store builds ship a small Codex.exe helper alongside
// ChatGPT.exe, which is the actual Electron desktop application.
const chatGpt = join(appRoot, "ChatGPT.exe");
if (existsSync(chatGpt)) return chatGpt;
const exe = readdirSync(appRoot).find((name) => /\.exe$/i.test(name) && /\bcodex\b/i.test(name));
if (exe) return join(appRoot, exe);
} catch {}
Expand Down
18 changes: 18 additions & 0 deletions packages/installer/test/platform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ test("locateCodex reads beta bundle metadata from override path on macOS", { ski
}
});

test("locateCodex prefers the Store desktop executable over the Codex helper on Windows", { skip: process.platform !== "win32" }, () => {
const root = mkdtempSync(join(tmpdir(), "codexpp-platform-"));
try {
const app = join(root, "OpenAI.Codex", "app");
mkdirSync(join(app, "resources"), { recursive: true });
writeFileSync(join(app, "resources", "app.asar"), "");
writeFileSync(join(app, "ChatGPT.exe"), "desktop");
writeFileSync(join(app, "Codex.exe"), "helper");

const codex = locateCodex(app);
assert.equal(codex.executable, join(app, "ChatGPT.exe"));
assert.equal(codex.electronBinary, join(app, "ChatGPT.exe"));
assert.equal(codex.appName, "ChatGPT");
} finally {
rmSync(root, { recursive: true, force: true });
}
});

test("resolveLinuxInstall supports am-will codex-app install directory", () => {
const root = mkdtempSync(join(tmpdir(), "codexpp-platform-"));
try {
Expand Down