Merge branch 'dotnet_sdk_detect_fix' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-dotnet_sdk_detect_fix

This commit is contained in:
Wojtek Figat
2025-04-12 22:21:12 +02:00

View File

@@ -235,8 +235,8 @@ namespace Flax.Build
ridFallback = "";
if (string.IsNullOrEmpty(dotnetPath))
{
dotnetPath = "/usr/local/share/dotnet/";
if (!Directory.Exists(dotnetPath)) // Officially recommended dotnet location
dotnetPath = "/usr/local/share/dotnet/"; // Officially recommended dotnet location
if (!Directory.Exists(dotnetPath))
{
if (Environment.GetEnvironmentVariable("PATH") is string globalBinPath)
dotnetPath = globalBinPath.Split(':').FirstOrDefault(x => File.Exists(Path.Combine(x, "dotnet")));
@@ -261,7 +261,7 @@ namespace Flax.Build
Log.Warning("Missing .NET SDK");
return;
}
if (!Directory.Exists(dotnetPath))
if (!Directory.Exists(Path.Combine(dotnetPath, "sdk")))
{
Log.Warning($"Missing .NET SDK ({dotnetPath})");
return;
@@ -513,6 +513,8 @@ namespace Flax.Build
private static IEnumerable<string> GetVersions(string folder)
{
if (!Directory.Exists(folder))
return Enumerable.Empty<string>();
return Directory.GetDirectories(folder).Select(Path.GetFileName);
}