[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
This commit is contained in:
committed by
GitHub
parent
a9c2f8b9e9
commit
9532b91c74
@@ -619,7 +619,7 @@ class FlutterValidator extends DoctorValidator {
|
||||
);
|
||||
}
|
||||
final String resolvedFlutterPath = flutterBin.resolveSymbolicLinksSync();
|
||||
if (!resolvedFlutterPath.contains(flutterRoot)) {
|
||||
if (!_filePathContainsDirPath(flutterRoot, resolvedFlutterPath)) {
|
||||
final String hint = 'Warning: `$binary` on your path resolves to '
|
||||
'$resolvedFlutterPath, which is not inside your current Flutter '
|
||||
'SDK checkout at $flutterRoot. Consider adding $flutterBinDir to '
|
||||
@@ -629,6 +629,13 @@ class FlutterValidator extends DoctorValidator {
|
||||
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) {
|
||||
final String? repositoryUrl = version.repositoryUrl;
|
||||
final VersionCheckError? upstreamValidationError = VersionUpstreamValidator(version: version, platform: _platform).run();
|
||||
|
||||
Reference in New Issue
Block a user