Skip to content

Commit

Permalink
Ensure exact match when installing Arduino_BuiltIn
Browse files Browse the repository at this point in the history
on the first IDE2 startup.

Closes arduino#1526

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
Akos Kitta authored and kittaakos committed Oct 7, 2022
1 parent 1e269ac commit 2d2be1f
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
} from '../../common/protocol';
import { Contribution } from './contribution';

const Arduino_BuiltIn = 'Arduino_BuiltIn';

@injectable()
export class FirstStartupInstaller extends Contribution {
@inject(LocalStorageService)
Expand All @@ -25,8 +27,8 @@ export class FirstStartupInstaller extends Contribution {
id: 'arduino:avr',
});
const builtInLibrary = (
await this.libraryService.search({ query: 'Arduino_BuiltIn' })
)[0];
await this.libraryService.search({ query: Arduino_BuiltIn })
).find(({ name }) => name === Arduino_BuiltIn); // Filter by `name` to ensure "exact match". See: https://github.com/arduino/arduino-ide/issues/1526.

let avrPackageError: Error | undefined;
let builtInLibraryError: Error | undefined;
Expand Down Expand Up @@ -84,7 +86,7 @@ export class FirstStartupInstaller extends Contribution {
}
if (builtInLibraryError) {
this.messageService.error(
`Could not install ${builtInLibrary.name} library: ${builtInLibraryError}`
`Could not install ${Arduino_BuiltIn} library: ${builtInLibraryError}`
);
}

Expand Down

0 comments on commit 2d2be1f

Please sign in to comment.