mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
Copying bundled signature file if missing from user's preferences folder
This commit is contained in:
parent
cf1879f948
commit
1f1f5b5c0e
@ -582,7 +582,6 @@ public class BaseNoGui {
|
||||
File defaultPackageJsonFile = new File(getContentFile("dist"), "package_index.json");
|
||||
if (!indexFile.isFile() || (defaultPackageJsonFile.isFile() && defaultPackageJsonFile.lastModified() > indexFile.lastModified())) {
|
||||
FileUtils.copyFile(defaultPackageJsonFile, indexFile);
|
||||
FileUtils.copyFile(new File(getContentFile("dist"), "package_index.json.sig"), new File(indexFile.getParent(), "package_index.json.sig"));
|
||||
} else if (!indexFile.isFile()) {
|
||||
// Otherwise create an empty packages index
|
||||
FileOutputStream out = null;
|
||||
@ -597,10 +596,17 @@ public class BaseNoGui {
|
||||
}
|
||||
}
|
||||
|
||||
File indexSignatureFile = indexer.getIndexFile("package_index.json.sig");
|
||||
File defaultPackageJsonSignatureFile = new File(getContentFile("dist"), "package_index.json.sig");
|
||||
if (!indexSignatureFile.isFile() || (defaultPackageJsonSignatureFile.isFile() && defaultPackageJsonSignatureFile.lastModified() > indexSignatureFile.lastModified())) {
|
||||
FileUtils.copyFile(defaultPackageJsonSignatureFile, indexSignatureFile);
|
||||
}
|
||||
|
||||
try {
|
||||
indexer.parseIndex();
|
||||
} catch (SignatureVerificationFailedException e) {
|
||||
indexFile.delete();
|
||||
indexSignatureFile.delete();
|
||||
throw e;
|
||||
}
|
||||
indexer.syncWithFilesystem(getHardwareFolder());
|
||||
|
Loading…
Reference in New Issue
Block a user