Fix generate_package_config script for Windows paths

The change
https://dart-review.googlesource.com/c/sdk/+/321722
does not handle a package path on Windows that uses backslashes.
Add handling for this case.

Bug: https://github.com/dart-lang/linter/issues/4411
Change-Id: I38fe39491ed60306dec1717b32f275c19ed0076b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322342
Reviewed-by: Jonas Termansen <sortie@google.com>
This commit is contained in:
William Hesse 2023-08-23 12:58:40 +00:00
parent 86c86d638a
commit 6d8ef05196

View file

@ -87,8 +87,8 @@ void main(List<String> args) {
if (p.name == name) p
];
if (name == 'linter' && matches.length > 1) {
final oldLinter = matches
.firstWhere((p) => p.rootUri.endsWith('third_party/pkg/linter'));
final oldLinter = matches.firstWhere((p) =>
p.rootUri.replaceAll(r'\', '/').endsWith('third_party/pkg/linter'));
packages.remove(oldLinter);
matches.remove(oldLinter);
}