Unverified Commit 592c5ba9 authored by Danny Tuppeny's avatar Danny Tuppeny Committed by GitHub

Don't be case-sensitive when checking for extension (#18515)

Seems like VS Code may have started using lowercase extension folders recently (our identifier is `Dart-Code.flutter` but now the folder is named `dart-code.flutter`), so this makes the check not sensitive to casing.

Also reuse extension identifier for download link
parent 3f79f8cb
...@@ -30,12 +30,13 @@ class VsCode { ...@@ -30,12 +30,13 @@ class VsCode {
} }
// Check for presence of extension. // Check for presence of extension.
final String extensionIdentifierLower = extensionIdentifier.toLowerCase();
final Iterable<FileSystemEntity> extensionDirs = fs final Iterable<FileSystemEntity> extensionDirs = fs
.directory(extensionDirectory) .directory(extensionDirectory)
.listSync() .listSync()
.where((FileSystemEntity d) => d is Directory) .where((FileSystemEntity d) => d is Directory)
.where( .where(
(FileSystemEntity d) => d.basename.startsWith(extensionIdentifier)); (FileSystemEntity d) => d.basename.toLowerCase().startsWith(extensionIdentifierLower));
if (extensionDirs.isNotEmpty) { if (extensionDirs.isNotEmpty) {
final FileSystemEntity extensionDir = extensionDirs.first; final FileSystemEntity extensionDir = extensionDirs.first;
......
...@@ -10,7 +10,7 @@ import 'vscode.dart'; ...@@ -10,7 +10,7 @@ import 'vscode.dart';
class VsCodeValidator extends DoctorValidator { class VsCodeValidator extends DoctorValidator {
static const String extensionMarketplaceUrl = static const String extensionMarketplaceUrl =
'https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter'; 'https://marketplace.visualstudio.com/items?itemName=${VsCode.extensionIdentifier}';
final VsCode _vsCode; final VsCode _vsCode;
VsCodeValidator(this._vsCode) : super(_vsCode.productName); VsCodeValidator(this._vsCode) : super(_vsCode.productName);
......
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