mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-29 18:52:13 +01:00
If previously downloaded package_index.json is older than the bundled one, the bundled one wins
This commit is contained in:
parent
2f31b8a80c
commit
4cf77cd90d
@ -1,11 +1,11 @@
|
||||
package processing.app;
|
||||
|
||||
import cc.arduino.contributions.libraries.LibrariesIndexer;
|
||||
import cc.arduino.contributions.packages.ContributedTool;
|
||||
import cc.arduino.contributions.packages.ContributionsIndexer;
|
||||
import cc.arduino.files.DeleteFilesOnShutdown;
|
||||
import cc.arduino.packages.DiscoveryManager;
|
||||
import cc.arduino.packages.Uploader;
|
||||
import cc.arduino.contributions.packages.ContributedTool;
|
||||
import cc.arduino.contributions.packages.ContributionsIndexer;
|
||||
import org.apache.commons.logging.impl.LogFactoryImpl;
|
||||
import org.apache.commons.logging.impl.NoOpLog;
|
||||
import processing.app.debug.Compiler;
|
||||
@ -578,11 +578,10 @@ public class BaseNoGui {
|
||||
static public void initPackages() throws Exception {
|
||||
indexer = new ContributionsIndexer(BaseNoGui.getSettingsFolder());
|
||||
File indexFile = indexer.getIndexFile();
|
||||
if (!indexFile.isFile()) {
|
||||
File defaultPackageJsonFile = new File(getContentFile("dist"), "package_index.json");
|
||||
if (defaultPackageJsonFile.isFile()) {
|
||||
if (!indexFile.isFile() || (defaultPackageJsonFile.isFile() && defaultPackageJsonFile.lastModified() > indexFile.lastModified())) {
|
||||
FileUtils.copyFile(defaultPackageJsonFile, indexFile);
|
||||
} else {
|
||||
} else if (!indexFile.isFile()) {
|
||||
// Otherwise create an empty packages index
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
@ -595,7 +594,6 @@ public class BaseNoGui {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
indexer.parseIndex();
|
||||
indexer.syncWithFilesystem(getHardwareFolder());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user