|
1 | 1 | package processing.app;
|
2 | 2 |
|
3 | 3 | import cc.arduino.contributions.libraries.LibrariesIndexer;
|
| 4 | +import cc.arduino.contributions.packages.ContributedTool; |
| 5 | +import cc.arduino.contributions.packages.ContributionsIndexer; |
4 | 6 | import cc.arduino.files.DeleteFilesOnShutdown;
|
5 | 7 | import cc.arduino.packages.DiscoveryManager;
|
6 | 8 | import cc.arduino.packages.Uploader;
|
7 |
| -import cc.arduino.contributions.packages.ContributedTool; |
8 |
| -import cc.arduino.contributions.packages.ContributionsIndexer; |
9 | 9 | import org.apache.commons.logging.impl.LogFactoryImpl;
|
10 | 10 | import org.apache.commons.logging.impl.NoOpLog;
|
11 | 11 | import processing.app.debug.Compiler;
|
@@ -578,21 +578,19 @@ static public void initLogger() {
|
578 | 578 | static public void initPackages() throws Exception {
|
579 | 579 | indexer = new ContributionsIndexer(BaseNoGui.getSettingsFolder());
|
580 | 580 | File indexFile = indexer.getIndexFile();
|
581 |
| - if (!indexFile.isFile()) { |
582 |
| - File defaultPackageJsonFile = new File(getContentFile("dist"), "package_index.json"); |
583 |
| - if (defaultPackageJsonFile.isFile()) { |
584 |
| - FileUtils.copyFile(defaultPackageJsonFile, indexFile); |
585 |
| - } else { |
586 |
| - // Otherwise create an empty packages index |
587 |
| - FileOutputStream out = null; |
588 |
| - try { |
589 |
| - out = new FileOutputStream(indexFile); |
590 |
| - out.write("{ \"packages\" : [ ] }".getBytes()); |
| 581 | + File defaultPackageJsonFile = new File(getContentFile("dist"), "package_index.json"); |
| 582 | + if (!indexFile.isFile() || (defaultPackageJsonFile.isFile() && defaultPackageJsonFile.lastModified() > indexFile.lastModified())) { |
| 583 | + FileUtils.copyFile(defaultPackageJsonFile, indexFile); |
| 584 | + } else if (!indexFile.isFile()) { |
| 585 | + // Otherwise create an empty packages index |
| 586 | + FileOutputStream out = null; |
| 587 | + try { |
| 588 | + out = new FileOutputStream(indexFile); |
| 589 | + out.write("{ \"packages\" : [ ] }".getBytes()); |
| 590 | + out.close(); |
| 591 | + } finally { |
| 592 | + if (out != null) { |
591 | 593 | out.close();
|
592 |
| - } finally { |
593 |
| - if (out != null) { |
594 |
| - out.close(); |
595 |
| - } |
596 | 594 | }
|
597 | 595 | }
|
598 | 596 | }
|
|
0 commit comments