Unverified Commit 9532b91c authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

[flutter_tools] normalize windows file path cases in flutter validator (#115889)

* normalize windows file path cases in flutter validator

* fix

* make comparison more accurate by checking .startsWith() rather than .contains()

* fix method name

* call path.canonicalize

* fix
parent a9c2f8b9
...@@ -619,7 +619,7 @@ class FlutterValidator extends DoctorValidator { ...@@ -619,7 +619,7 @@ class FlutterValidator extends DoctorValidator {
); );
} }
final String resolvedFlutterPath = flutterBin.resolveSymbolicLinksSync(); final String resolvedFlutterPath = flutterBin.resolveSymbolicLinksSync();
if (!resolvedFlutterPath.contains(flutterRoot)) { if (!_filePathContainsDirPath(flutterRoot, resolvedFlutterPath)) {
final String hint = 'Warning: `$binary` on your path resolves to ' final String hint = 'Warning: `$binary` on your path resolves to '
'$resolvedFlutterPath, which is not inside your current Flutter ' '$resolvedFlutterPath, which is not inside your current Flutter '
'SDK checkout at $flutterRoot. Consider adding $flutterBinDir to ' 'SDK checkout at $flutterRoot. Consider adding $flutterBinDir to '
...@@ -629,6 +629,13 @@ class FlutterValidator extends DoctorValidator { ...@@ -629,6 +629,13 @@ class FlutterValidator extends DoctorValidator {
return null; return null;
} }
bool _filePathContainsDirPath(String directory, String file) {
// calling .canonicalize() will normalize for alphabetic case and path
// separators
return (_fileSystem.path.canonicalize(file))
.startsWith(_fileSystem.path.canonicalize(directory) + _fileSystem.path.separator);
}
ValidationMessage _getFlutterUpstreamMessage(FlutterVersion version) { ValidationMessage _getFlutterUpstreamMessage(FlutterVersion version) {
final String? repositoryUrl = version.repositoryUrl; final String? repositoryUrl = version.repositoryUrl;
final VersionCheckError? upstreamValidationError = VersionUpstreamValidator(version: version, platform: _platform).run(); final VersionCheckError? upstreamValidationError = VersionUpstreamValidator(version: version, platform: _platform).run();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment