File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,13 +31,20 @@ foreach ($arg in $args) {
3131 if ($arg -like " --dir=*" ) { $InstallDir = $arg.Substring (6 ) }
3232}
3333
34- # Detect architecture (ARM64 vs x64). PROCESSOR_ARCHITEW6432 is set to ARM64
35- # when an x86/x64 process runs under emulation on ARM hardware, so check both to
36- # resolve ARM64 even from an emulated shell; anything else falls back to amd64.
37- if ($env: PROCESSOR_ARCHITECTURE -eq " ARM64" -or $env: PROCESSOR_ARCHITEW6432 -eq " ARM64" ) {
38- $Arch = " arm64"
39- } else {
40- $Arch = " amd64"
34+ # Detect the OS architecture. RuntimeInformation.OSArchitecture reports the real
35+ # OS arch (Arm64) even from an x64 process running under emulation on ARM64 --
36+ # unlike $env:PROCESSOR_ARCHITECTURE, which reports the emulated "AMD64", and
37+ # PROCESSOR_ARCHITEW6432, which is unset for 64-bit emulated processes. Fall back
38+ # to the env vars only if the .NET API is somehow unavailable.
39+ try {
40+ $osArch = [System.Runtime.InteropServices.RuntimeInformation ]::OSArchitecture
41+ $Arch = if ($osArch -eq ' Arm64' ) { " arm64" } else { " amd64" }
42+ } catch {
43+ if ($env: PROCESSOR_ARCHITECTURE -eq " ARM64" -or $env: PROCESSOR_ARCHITEW6432 -eq " ARM64" ) {
44+ $Arch = " arm64"
45+ } else {
46+ $Arch = " amd64"
47+ }
4148}
4249
4350Write-Host " codebase-memory-mcp installer (Windows)"
You can’t perform that action at this time.
0 commit comments