Skip to content

Commit

Permalink
Lucene.Net.Util.Constants: Added version detection for .NET Framework…
Browse files Browse the repository at this point in the history
… 4.8.1. Updated FreeBSD/SunOS detection use uppercase strings as was done in the tests in dotnet/runtime (note I don't believe SunOS is currently supported, but maybe someday it will be).
  • Loading branch information
NightOwl888 committed May 24, 2024
1 parent 9b74275 commit 38a7b53
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Lucene.Net/Util/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ public static class Constants // LUCENENET specific - made static because all me

/// <summary>
/// True iff running on SunOS. </summary>
public static readonly bool SUN_OS = RuntimeInformation.IsOSPlatform(OSPlatform.Create("SunOS"));
public static readonly bool SUN_OS = RuntimeInformation.IsOSPlatform(OSPlatform.Create("SUNOS"));

/// <summary>
/// True iff running on Mac OS X </summary>
public static readonly bool MAC_OS_X = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);

/// <summary>
/// True iff running on FreeBSD </summary>
public static readonly bool FREE_BSD = RuntimeInformation.IsOSPlatform(OSPlatform.Create("FreeBSD"));
public static readonly bool FREE_BSD = RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD"));

// Possible Values: X86, X64, Arm, Arm64
public static readonly string OS_ARCH = RuntimeInformation.OSArchitecture.ToString();
Expand Down Expand Up @@ -197,6 +197,8 @@ private static string GetFramework45PlusFromRegistry()
// Checking the version using >= will enable forward compatibility.
private static string CheckFor45PlusVersion(int releaseKey)
{
if (releaseKey >= 533320)
return "4.8.1";
if (releaseKey >= 460799)
return "4.8";
if (releaseKey >= 460798)
Expand Down Expand Up @@ -241,4 +243,4 @@ private static string ExtractString(string input, Regex pattern)
return (m.Groups.Count > 1) ? m.Groups[1].Value : string.Empty;
}
}
}
}

0 comments on commit 38a7b53

Please sign in to comment.