Skip to content

Commit

Permalink
Add check for translations in mac pkg installers (#7919)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfoslund authored Sep 21, 2021
1 parent 88279c9 commit 42b72b1
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,18 @@ function IsX64Machine() {
var machine = system.sysctl(""hw.machine"");
var cputype = system.sysctl(""hw.cputype"");
var cpu64 = system.sysctl(""hw.cpu64bit_capable"");
var translated = system.sysctl(""sysctl.proc_translated"");
system.log(""Machine type: "" + machine);
system.log(""Cpu type: "" + cputype);
system.log(""64-bit: "" + cpu64);
system.log(""Translated: "" + translated);
// From machine.h
// CPU_TYPE_X86_64 = CPU_TYPE_X86 | CPU_ARCH_ABI64 = 0x010000007 = 16777223
// CPU_TYPE_X86 = 7
var result = machine == ""amd64"" || machine == ""x86_64"" || cputype == ""16777223"" || (cputype == ""7"" && cpu64 == ""1"");
// We may be running under translation (Rosetta) that makes it seem like system is x64, if so assume machine is not actually x64
result = result && (translated != ""1"");
system.log(""IsX64Machine: "" + result);
return result;
}
Expand Down

0 comments on commit 42b72b1

Please sign in to comment.