Fixed: macOS version detection

This commit is contained in:
Bogdan 2023-09-08 03:12:46 +03:00 committed by GitHub
parent 1b3ff64cc5
commit 060be6177a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -15,6 +15,9 @@ namespace NzbDrone.Mono.Test.EnvironmentInfo.VersionAdapters
[TestCase("10.8")] [TestCase("10.8")]
[TestCase("10.8.1")] [TestCase("10.8.1")]
[TestCase("10.11.20")] [TestCase("10.11.20")]
[TestCase("11.7.9")]
[TestCase("12.6.8")]
[TestCase("13.5.1")]
public void should_get_version_info(string versionString) public void should_get_version_info(string versionString)
{ {
var fileContent = File.ReadAllText(GetTestPath("Files/macOS/SystemVersion.plist")).Replace("10.0.0", versionString); var fileContent = File.ReadAllText(GetTestPath("Files/macOS/SystemVersion.plist")).Replace("10.0.0", versionString);

View File

@ -10,7 +10,7 @@ namespace NzbDrone.Mono.EnvironmentInfo.VersionAdapters
{ {
private const string PLIST_DIR = "/System/Library/CoreServices/"; private const string PLIST_DIR = "/System/Library/CoreServices/";
private static readonly Regex DarwinVersionRegex = new Regex("<string>(?<version>10\\.\\d{1,2}\\.?\\d{0,2}?)<\\/string>", private static readonly Regex DarwinVersionRegex = new ("<key>ProductVersion<\\/key>\\s*<string>(?<version>1\\d\\.\\d{1,2}\\.?\\d{0,2}?)<\\/string>",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly IDiskProvider _diskProvider; private readonly IDiskProvider _diskProvider;