Skip to content

Commit

Permalink
BUGFIX: Do not include 'shared' in default UNIX dotnet installation p…
Browse files Browse the repository at this point in the history
…aths. Add default macOS dotnet installation folder.
  • Loading branch information
Washi1337 committed Apr 9, 2022
1 parent 788c6b3 commit fb3516a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/AsmResolver.DotNet/DotNetCorePathProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ namespace AsmResolver.DotNet
public class DotNetCorePathProvider
{
private static readonly string[] DefaultDotNetUnixPaths = {
"/usr/share/dotnet/shared",
"/opt/dotnet/shared/"
"/usr/share/dotnet/",
"/usr/local/share/dotnet/",
"/opt/dotnet/"
};

private static readonly Regex NetCoreRuntimePattern = new(@"\.NET( Core)? \d+\.\d+\.\d+");
Expand All @@ -23,7 +24,7 @@ public class DotNetCorePathProvider
static DotNetCorePathProvider()
{
DefaultInstallationPath = FindDotNetPath();
Default = new();
Default = new DotNetCorePathProvider();
}

/// <summary>
Expand Down Expand Up @@ -153,8 +154,12 @@ public bool HasRuntimeInstalled(string runtimeName, Version runtimeVersion)
private void DetectInstalledRuntimes(string installationDirectory)
{
installationDirectory = Path.Combine(installationDirectory, "shared");
if (!Directory.Exists(installationDirectory))
return;

foreach (string directory in Directory.EnumerateDirectories(installationDirectory))
_installedRuntimes.Add(new DotNetInstallationInfo(directory));

_installedRuntimes.Sort();
}

Expand Down

0 comments on commit fb3516a

Please sign in to comment.