Skip to content

Commit 5d838db

Browse files
author
Akos Kitta
committed
Ensure exact match when installing Arduino_BuiltIn
on the first IDE2 startup. Closes #1526 Signed-off-by: Akos Kitta <[email protected]>
1 parent 6ed532c commit 5d838db

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: arduino-ide-extension/src/browser/contributions/first-startup-installer.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {
77
} from '../../common/protocol';
88
import { Contribution } from './contribution';
99

10+
const Arduino_BuiltIn = 'Arduino_BuiltIn';
11+
1012
@injectable()
1113
export class FirstStartupInstaller extends Contribution {
1214
@inject(LocalStorageService)
@@ -25,8 +27,8 @@ export class FirstStartupInstaller extends Contribution {
2527
id: 'arduino:avr',
2628
});
2729
const builtInLibrary = (
28-
await this.libraryService.search({ query: 'Arduino_BuiltIn' })
29-
)[0];
30+
await this.libraryService.search({ query: Arduino_BuiltIn })
31+
).find(({ name }) => name === Arduino_BuiltIn); // Filter by `name` to ensure "exact match". See: https://github.com/arduino/arduino-ide/issues/1526.
3032

3133
let avrPackageError: Error | undefined;
3234
let builtInLibraryError: Error | undefined;
@@ -84,7 +86,7 @@ export class FirstStartupInstaller extends Contribution {
8486
}
8587
if (builtInLibraryError) {
8688
this.messageService.error(
87-
`Could not install ${builtInLibrary.name} library: ${builtInLibraryError}`
89+
`Could not install ${Arduino_BuiltIn} library: ${builtInLibraryError}`
8890
);
8991
}
9092

0 commit comments

Comments
 (0)