Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions Utils/PlatformHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,20 @@ private static void DeterminePlatform() {
*/
try {
string arch;
using (Process uname = Process.Start(new ProcessStartInfo("uname", "-m") {
UseShellExecute = false,
RedirectStandardOutput = true
})) {
ProcessStartInfo processInfo;
if (Is(Platform.MacOS)) {
// on Rosetta environment, `uname -m` shows actual hardware architecture "arm64"
// and `arch` shows current hardware architecture `i386`
// We want to know current architecture so we call arch instead of uname.
processInfo = new ProcessStartInfo("arch") {
UseShellExecute = false, RedirectStandardOutput = true
};
} else {
processInfo = new ProcessStartInfo("uname", "-m") {
UseShellExecute = false, RedirectStandardOutput = true
};
}
using (Process uname = Process.Start(processInfo)) {
arch = uname.StandardOutput.ReadLine().Trim();
}

Expand Down