Skip to content

Commit 29912a0

Browse files
committed
Remove temporary files when updating library_index.json
Fix #4272 #4332
1 parent a6e36fa commit 29912a0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: arduino-core/src/cc/arduino/contributions/GZippedJsonDownloader.java

+5
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,13 @@ public void download(File tmpFile, Progress progress, String statusText, Progres
5353
try {
5454
new JsonDownloader(downloader, gzippedUrl).download(tmpFile, progress, statusText, progressListener);
5555
File gzipTmpFile = new File(tmpFile.getParentFile(), GzipUtils.getCompressedFilename(tmpFile.getName()));
56+
// remove eventual leftovers from previous downloads
57+
if (gzipTmpFile.exists()) {
58+
gzipTmpFile.delete();
59+
}
5660
tmpFile.renameTo(gzipTmpFile);
5761
decompress(gzipTmpFile, tmpFile);
62+
gzipTmpFile.delete();
5863
} catch (Exception e) {
5964
new JsonDownloader(downloader, url).download(tmpFile, progress, statusText, progressListener);
6065
}

0 commit comments

Comments
 (0)