mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 10:35:27 +08:00 
			
		
		
		
	Update regex to correctly identify Windows 10
When running .NET Core 2.1 or .NET Framework 4.6.1, the used regex for detecting Windows 10 TrueColor support does not match the OSDescription. The reason for this is because on those frameworks the description has trailing whitespaces, but they do not on .NET Core 3.1. This commit updates the regex to ignore any trailing whitespaces.
This commit is contained in:
		
				
					committed by
					
						
						Patrik Svensson
					
				
			
			
				
	
			
			
			
						parent
						
							646f51a628
						
					
				
				
					commit
					2e7b3d520a
				
			@@ -19,7 +19,7 @@ namespace Spectre.Console.Internal
 | 
			
		||||
            {
 | 
			
		||||
                if (supportsAnsi)
 | 
			
		||||
                {
 | 
			
		||||
                    var regex = new Regex("^Microsoft Windows (?'major'[0-9]*).(?'minor'[0-9]*).(?'build'[0-9]*)$");
 | 
			
		||||
                    var regex = new Regex("^Microsoft Windows (?'major'[0-9]*).(?'minor'[0-9]*).(?'build'[0-9]*)\\s*$");
 | 
			
		||||
                    var match = regex.Match(RuntimeInformation.OSDescription);
 | 
			
		||||
                    if (match.Success && int.TryParse(match.Groups["major"].Value, out var major))
 | 
			
		||||
                    {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user