1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-19 08:52:15 +01:00

Do not fail if the data folder can't be read

Fix #7937
This commit is contained in:
Cristian Maglie 2018-09-03 15:20:00 +02:00 committed by Cristian Maglie
parent fd28ded160
commit fe424ae39b

View File

@ -55,6 +55,7 @@ import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
import static processing.app.I18n.format;
import static processing.app.I18n.tr;
import static processing.app.helpers.filefilters.OnlyDirs.ONLY_DIRS;
@ -100,14 +101,18 @@ public class ContributionsIndexer {
// Overlay 3rd party indexes
File[] indexFiles = preferencesFolder.listFiles(new TestPackageIndexFilenameFilter(new PackageIndexFilenameFilter(Constants.DEFAULT_INDEX_FILE_NAME)));
if (indexFiles != null) {
for (File indexFile : indexFiles) {
try {
mergeContributions(indexFile);
} catch (JsonProcessingException e) {
System.err.println(I18n.format(tr("Skipping contributed index file {0}, parsing error occured:"), indexFile));
System.err.println(format(tr("Skipping contributed index file {0}, parsing error occured:"), indexFile));
System.err.println(e);
}
}
} else {
System.err.println(format(tr("Error reading package indexes folder: {0}\n(maybe a permission problem?)"), preferencesFolder));
}
// Fill tools and toolsDependency cross references
List<ContributedPackage> packages = index.getPackages();