From c61c39f5d96967cf7b7f066d59c822831e511102 Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Tue, 4 Aug 2015 09:10:40 +0200 Subject: [PATCH] Canceling self check timer when opening boards/libs manager --- app/src/processing/app/Base.java | 7 ++++++- .../contributions/packages/ContributionInstaller.java | 11 ++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 088b14b9e..760f86a34 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -1259,6 +1259,9 @@ public class Base { } public void openLibraryManager(String dropdownItem) { + if (selfCheckTimer != null) { + selfCheckTimer.cancel(); + } @SuppressWarnings("serial") LibraryManagerUI managerUI = new LibraryManagerUI(activeEditor, BaseNoGui.getPlatform()) { @Override @@ -1285,7 +1288,9 @@ public class Base { } public void openBoardsManager(final String filterText, String dropdownItem) throws Exception { - // Create dialog for contribution manager + if (selfCheckTimer != null) { + selfCheckTimer.cancel(); + } @SuppressWarnings("serial") ContributionManagerUI managerUI = new ContributionManagerUI(activeEditor, BaseNoGui.getPlatform()) { @Override diff --git a/arduino-core/src/cc/arduino/contributions/packages/ContributionInstaller.java b/arduino-core/src/cc/arduino/contributions/packages/ContributionInstaller.java index 52cdf1c64..5925a340b 100644 --- a/arduino-core/src/cc/arduino/contributions/packages/ContributionInstaller.java +++ b/arduino-core/src/cc/arduino/contributions/packages/ContributionInstaller.java @@ -322,15 +322,8 @@ public class ContributionInstaller { File tmpFile = new File(outputFile.getAbsolutePath() + ".tmp"); downloader.download(url, tmpFile, progress, statusText); - // Replace old index with the updated one - if (outputFile.exists()) { - if (!outputFile.delete()) { - throw new Exception("An error occurred while updating platforms index! I can't delete file " + outputFile); - } - } - if (!tmpFile.renameTo(outputFile)) { - throw new Exception("An error occurred while updating platforms index! I can't rename file " + tmpFile); - } + Files.deleteIfExists(outputFile.toPath()); + Files.move(tmpFile.toPath(), outputFile.toPath()); return outputFile; }