|
7 | 7 | using System.Net.Http; |
8 | 8 | using System.Net.Http.Json; |
9 | 9 | using System.Runtime.InteropServices; |
| 10 | +using System.Text; |
10 | 11 | using System.Text.Json; |
11 | 12 | using System.Text.Json.Serialization; |
12 | 13 | using System.Threading; |
@@ -574,12 +575,17 @@ private async Task<ContentLaunchInfo> InstallContentBundleAsync( |
574 | 575 | startInfo.UseShellExecute = false; |
575 | 576 | startInfo.ArgumentList.AddRange(extraArgs); |
576 | 577 |
|
577 | | - /* |
578 | | - foreach (var arg in startInfo.ArgumentList) |
| 578 | + var commandBuilder = new StringBuilder(); |
| 579 | + commandBuilder.Append(startInfo.FileName); |
| 580 | + |
| 581 | + for (var i = 0; i < startInfo.ArgumentList.Count; i++) |
579 | 582 | { |
580 | | - Log.Debug("arg: {Arg}", arg); |
| 583 | + var arg = startInfo.ArgumentList[i]; |
| 584 | + |
| 585 | + commandBuilder.Append($" [{i}] {arg}"); |
581 | 586 | } |
582 | | - */ |
| 587 | + |
| 588 | + Log.Debug("Launch command: {LaunchCommand}", commandBuilder.ToString()); |
583 | 589 |
|
584 | 590 | var process = Process.Start(startInfo); |
585 | 591 |
|
@@ -743,13 +749,31 @@ private static async Task<ProcessStartInfo> GetLoaderStartInfo() |
743 | 749 |
|
744 | 750 | await xattr.WaitForExitAsync(); |
745 | 751 |
|
746 | | - var arch = RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? "arm64" : "x86_64"; |
747 | | - |
748 | | - return new ProcessStartInfo |
| 752 | + var startInfo = new ProcessStartInfo |
749 | 753 | { |
750 | 754 | FileName = "open", |
751 | | - ArgumentList = {appPath, "--arch", arch, "--args"}, |
| 755 | + ArgumentList = { appPath } |
752 | 756 | }; |
| 757 | + |
| 758 | + if (RuntimeInformation.OSArchitecture != Architecture.X64) |
| 759 | + { |
| 760 | + // Intel macs may be running unsupported macOS versions without open --arch. |
| 761 | + // So don't add it. It's not necessary anyways. |
| 762 | + |
| 763 | + // Versions before Sonoma also don't have it. |
| 764 | + // If you're on one of those... uhh.. Why are you running an outdated OS? |
| 765 | + // But don't add --arch so that people on an outdated OS can still use native Apple Silicon. |
| 766 | + if (OperatingSystem.IsMacOSVersionAtLeast(14)) |
| 767 | + { |
| 768 | + startInfo.ArgumentList.Add("--arch"); |
| 769 | + startInfo.ArgumentList.Add( |
| 770 | + RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? "arm64" : "x86_64"); |
| 771 | + } |
| 772 | + } |
| 773 | + |
| 774 | + startInfo.ArgumentList.Add("--args"); |
| 775 | + |
| 776 | + return startInfo; |
753 | 777 | } |
754 | 778 | else |
755 | 779 | { |
|
0 commit comments