Skip to content

Commit

Permalink
Fixed: macOS version detection
Browse files Browse the repository at this point in the history
  • Loading branch information
mynameisbogdan committed Sep 8, 2023
1 parent 1b3ff64 commit 060be61
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Expand Up @@ -15,6 +15,9 @@ public class MacOsVersionAdapterFixture : TestBase<MacOsVersionAdapter>
[TestCase("10.8")]
[TestCase("10.8.1")]
[TestCase("10.11.20")]
[TestCase("11.7.9")]
[TestCase("12.6.8")]
[TestCase("13.5.1")]
public void should_get_version_info(string versionString)
{
var fileContent = File.ReadAllText(GetTestPath("Files/macOS/SystemVersion.plist")).Replace("10.0.0", versionString);
Expand Down
Expand Up @@ -10,7 +10,7 @@ public class MacOsVersionAdapter : IOsVersionAdapter
{
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);

private readonly IDiskProvider _diskProvider;
Expand Down

0 comments on commit 060be61

Please sign in to comment.