-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Current State
Currently the windows version validator uses the windows command systeminfo to determine the windows version. The relevant stdout is shown below.
Host Name: XXXXXXXXXXXX
OS Name: Microsoft Windows 10 Enterprise
OS Version: 10.0.19044 N/A Build 19044
OS Manufacturer: Microsoft Corporation
OS Configuration: Member Workstation
OS Build Type: Multiprocessor Free
...
The third line is what we use to parse if the windows version is supported in flutter, however this text can appear different in different locales (Versione SO: 10.0.22621 N/D build 22621 in Italy) so it is difficult to create a regex pattern that captures all variations
Proposed Solution
Instead of using the systeminfo command, we should instead use ver which returns information only related to the version. An example output for the en-US locale is shown below
Microsoft Windows [Version 10.0.22621.819]
This will be easier to extract the version number because the stdout is just one line. Note that this is still affected by the locale. The below is what gets outputted in the it-IT locale (Italy) ie. Version --> Versione
Microsoft Windows [Versione 10.0.22621.819]
The ver command is already being executed within the flutter_tools codebase using the Windows Utility class in https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/base/os.dart#L568-L580 so instead of making a call within the validator, we will just use the existing method to generate the output from ver