Skip to content

Commit c61c39f

Browse files
author
Federico Fissore
committed
Canceling self check timer when opening boards/libs manager
1 parent f9612bc commit c61c39f

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

app/src/processing/app/Base.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,9 @@ public void onBoardOrPortChange() {
12591259
}
12601260

12611261
public void openLibraryManager(String dropdownItem) {
1262+
if (selfCheckTimer != null) {
1263+
selfCheckTimer.cancel();
1264+
}
12621265
@SuppressWarnings("serial")
12631266
LibraryManagerUI managerUI = new LibraryManagerUI(activeEditor, BaseNoGui.getPlatform()) {
12641267
@Override
@@ -1285,7 +1288,9 @@ protected void onIndexesUpdated() throws Exception {
12851288
}
12861289

12871290
public void openBoardsManager(final String filterText, String dropdownItem) throws Exception {
1288-
// Create dialog for contribution manager
1291+
if (selfCheckTimer != null) {
1292+
selfCheckTimer.cancel();
1293+
}
12891294
@SuppressWarnings("serial")
12901295
ContributionManagerUI managerUI = new ContributionManagerUI(activeEditor, BaseNoGui.getPlatform()) {
12911296
@Override

arduino-core/src/cc/arduino/contributions/packages/ContributionInstaller.java

+2-9
Original file line numberDiff line numberDiff line change
@@ -322,15 +322,8 @@ private File download(MultiStepProgress progress, String packageIndexUrl) throws
322322
File tmpFile = new File(outputFile.getAbsolutePath() + ".tmp");
323323
downloader.download(url, tmpFile, progress, statusText);
324324

325-
// Replace old index with the updated one
326-
if (outputFile.exists()) {
327-
if (!outputFile.delete()) {
328-
throw new Exception("An error occurred while updating platforms index! I can't delete file " + outputFile);
329-
}
330-
}
331-
if (!tmpFile.renameTo(outputFile)) {
332-
throw new Exception("An error occurred while updating platforms index! I can't rename file " + tmpFile);
333-
}
325+
Files.deleteIfExists(outputFile.toPath());
326+
Files.move(tmpFile.toPath(), outputFile.toPath());
334327

335328
return outputFile;
336329
}

0 commit comments

Comments
 (0)