diff --git a/src/handlers/installationHandlers.js b/src/handlers/installationHandlers.js index 7fdceb2..b37afc5 100644 --- a/src/handlers/installationHandlers.js +++ b/src/handlers/installationHandlers.js @@ -80,8 +80,8 @@ export async function checkCodexInstallation(config, showNavigationMenu) { } } -async function saveCodexExePathToConfig(config) { - config.codexExe = path.join(process.env.LOCALAPPDATA, "Codex", "codex.exe"); +async function saveCodexExePathToConfig(config, codexExePath) { + config.codexExe = codexExePath; if (!fs.existsSync(config.codexExe)) { console.log(showErrorMessage(`Codex executable not found in expected path: ${config.codexExe}`)); throw new Error("Exe not found"); @@ -116,7 +116,7 @@ export async function installCodex(config, showNavigationMenu) { await runCommand('curl -LO --ssl-no-revoke https://get.codex.storage/install.cmd'); await runCommand(`"${process.cwd()}\\install.cmd"`); - await saveCodexExePathToConfig(config); + await saveCodexExePathToConfig(config, path.join(process.env.LOCALAPPDATA, "Codex", "codex.exe")); try { await runCommand('del /f install.cmd'); @@ -158,6 +158,8 @@ export async function installCodex(config, showNavigationMenu) { } else { await runCommand('timeout 120 bash install.sh'); } + + await saveCodexExePathToConfig(config, path.join(process.env.LOCALAPPDATA, "Codex", "codex")); } catch (error) { if (error.message.includes('ECONNREFUSED') || error.message.includes('ETIMEDOUT')) {