build-nvidia: find rustup's cargo when PATH is stale, say to install Rust otherwise (#3117) #3342
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3342"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T14:30:34Z.
Claim:
BUILD-CARGO-MISSINGin #3312. Fixes #3117.Players hit "The term 'cargo' is not recognized" at launch (#3117; five reports in the public channels on 2026-12-03). Two causes: Rust is not installed, or it was installed from a window opened before rustup changed
PATH, so the launcher's shell still does not see it.d3d12/scripts/build-nvidia.ps1calledcargowithout checking.Now, before the build, when
cargois not onPATH:%USERPROFILE%\.cargo\bin\cargo.exeexists (rustup's own folder), it is added toPATHfor this build;scripts/play-d3d12.ps1already turns into "cargo build failed".This is the build script, not the launcher (#3341 leaves
play*.ps1and build scripts open); OreoFR is asked to review as the launcher calls it.Tested (Windows 11)
PATHwithout cargo and an empty profile folder: prints the message, exit 9009.PATHwithout cargo, profile folder with.cargo\bin\cargo.exe:Get-Command cargoresolves to that file and the build is attempted.scripts/check_no_game_data.pyon the file: clean. No game run needed (the build itself is unchanged when cargo is onPATH).AI-assisted (Claude Code, Claude Opus 5.5). Independent review: a separate Claude Opus 5.5 agent before merge.
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T14:31:54Z.
This overlaps the build preflight in #3187 and the shared lookup in #3263. I checked
2a29d1af, #31878af4eb44, and #32639c2e340bagainst128579e9. Both older PRs now conflict with this one inbuild-nvidia.ps1.One case worth carrying over is a configured
CARGO_HOME. With a synthetic Cargo in$env:CARGO_HOME/bin, an empty default profile, and a stalePATH, this head reports Rust missing without invoking the stub. Both existing PRs invoke it withbuild --locked --profile diag -p leonida. Their build preflights also passed the default-home, PATH-priority, and missing-install cases in PowerShell 7.6.6 on Linux. For #3263, the Cargo, launcher, and gate test files produced 47 passes and 7 Windows-only skips.The shared lookup in #3263 also covers the direct launcher’s earlier Cargo check. If this PR lands first, the overlapping build hunk can keep a single preflight and retain
CARGO_HOMEsupport. This check used synthetic executables and does not replace the Windows launcher run in the PR description. AI-assisted (Codex).Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T14:37:26Z.
Rechecked the change on
6c8e856d. A configuredCARGO_HOMEnow works with stalePATH, including whenUSERPROFILEis unset. When both homes contain Cargo, the custom home wins, and an existingPATHentry still takes precedence.Two path cases remain in the candidate probe.
CARGO_HOMEnamedcargo [sdk]misses an existingbin/cargo.exebecauseTest-Pathtreats the brackets as a pattern. A directory namedcargo.exealso passes the current existence check and then produces a generic command-not-found error.Test-Path -LiteralPath (Join-Path $_ 'cargo.exe') -PathType Leafhandled both. All seven cases then passed. This was PowerShell 7.6.6 on Linux with synthetic Cargo files and the platform PATH separator substituted for;. AI-assisted (Codex).