diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-09-14 18:13:06 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-09-14 18:31:52 +0300 |
commit | f4f556d198dac074091c1ecde6347321bd6ac298 (patch) | |
tree | 2bc12174ef2d7ca688251910463622d6c3d11380 /modules/mono/editor | |
parent | bf271ea6af5e4e1dbf12a5428445f0efa54f8651 (diff) |
[macOS, .NET] Fix dotnet binary detection.
Diffstat (limited to 'modules/mono/editor')
-rw-r--r-- | modules/mono/editor/GodotTools/GodotTools/Build/DotNetFinder.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/DotNetFinder.cs b/modules/mono/editor/GodotTools/GodotTools/Build/DotNetFinder.cs index 7bce53308c..b437c7e742 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/DotNetFinder.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/DotNetFinder.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; +using System.Runtime.InteropServices; using JetBrains.Annotations; using OS = GodotTools.Utils.OS; @@ -16,6 +17,23 @@ namespace GodotTools.Build // In the future, this method may do more than just search in PATH. We could look in // known locations or use Godot's linked nethost to search from the hostfxr location. + if (OS.IsMacOS) + { + if (RuntimeInformation.OSArchitecture == Architecture.X64) + { + string dotnet_x64 = "/usr/local/share/dotnet/x64/dotnet"; // Look for x64 version, when running under Rosetta 2. + if (File.Exists(dotnet_x64)) + { + return dotnet_x64; + } + } + string dotnet = "/usr/local/share/dotnet/dotnet"; // Look for native version. + if (File.Exists(dotnet)) + { + return dotnet; + } + } + return OS.PathWhich("dotnet"); } |