Avoid Windows installer detection for sandbox helper

This commit is contained in:
David Wiesen
2026-05-22 09:56:26 -07:00
parent 0035d7bd18
commit fb2928bd21
3 changed files with 21 additions and 16 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ BINARY_COMPONENTS = {
"codex-windows-sandbox-setup": BinaryComponent(
artifact_prefix="codex-windows-sandbox-setup",
dest_dir="codex",
binary_basename="codex-windows-sandbox-setup",
binary_basename="codex-windows-sandbox",
targets=WINDOWS_TARGETS,
),
"codex-command-runner": BinaryComponent(
@@ -556,25 +556,30 @@ fn quote_arg(arg: &str) -> String {
}
fn find_setup_exe() -> PathBuf {
const HELPER_EXE_NAMES: [&str; 2] = [
"codex-windows-sandbox.exe",
"codex-windows-sandbox-setup.exe",
];
if let Ok(exe) = std::env::current_exe()
&& let Some(dir) = exe.parent()
{
let candidate = dir.join("codex-windows-sandbox-setup.exe");
if candidate.exists() {
return candidate;
}
for helper_name in HELPER_EXE_NAMES {
let candidate = dir.join(helper_name);
if candidate.exists() {
return candidate;
}
// Standalone installs keep Windows helper binaries under
// `codex-resources/` next to `codex.exe`, so elevation needs to probe
// that sibling folder before falling back to PATH.
let resource_candidate = dir
.join("codex-resources")
.join("codex-windows-sandbox-setup.exe");
if resource_candidate.exists() {
return resource_candidate;
// Standalone installs keep Windows helper binaries under
// `codex-resources/` next to `codex.exe`, so elevation needs to
// probe that sibling folder before falling back to PATH.
let resource_candidate = dir.join("codex-resources").join(helper_name);
if resource_candidate.exists() {
return resource_candidate;
}
}
}
PathBuf::from("codex-windows-sandbox-setup.exe")
PathBuf::from(HELPER_EXE_NAMES[0])
}
fn report_helper_failure(
+2 -2
View File
@@ -463,7 +463,7 @@ function Test-ReleaseIsComplete {
$expectedFiles = @(
"codex.exe",
"codex-resources\codex-command-runner.exe",
"codex-resources\codex-windows-sandbox-setup.exe",
"codex-resources\codex-windows-sandbox.exe",
"codex-resources\rg.exe"
)
foreach ($name in $expectedFiles) {
@@ -673,7 +673,7 @@ try {
$copyMap = @{
"codex/codex.exe" = "codex.exe"
"codex/codex-command-runner.exe" = "codex-resources\codex-command-runner.exe"
"codex/codex-windows-sandbox-setup.exe" = "codex-resources\codex-windows-sandbox-setup.exe"
"codex/codex-windows-sandbox.exe" = "codex-resources\codex-windows-sandbox.exe"
"path/rg.exe" = "codex-resources\rg.exe"
}