attempt to fix install path for non-windows

This commit is contained in:
Ben 2025-02-17 12:41:19 +01:00
parent 771888f427
commit 27bd79d4b1
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B

View File

@ -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');
@ -159,6 +159,8 @@ export async function installCodex(config, showNavigationMenu) {
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')) {
throw new Error('Installation failed. Please check your internet connection and try again.');