Added empty library_index.json if default is not available.

This commit is contained in:
Cristian Maglie 2014-05-16 18:44:33 +02:00 committed by Federico Fissore
parent 98fec7222b
commit 12a2d872d6
1 changed files with 11 additions and 0 deletions

View File

@ -620,6 +620,17 @@ public class BaseNoGui {
loadContributedHardware(indexer);
librariesIndexer = new LibrariesIndexer(BaseNoGui.getSettingsFolder());
File librariesIndexFile = librariesIndexer.getIndexFile();
if (!librariesIndexFile.isFile()) {
try {
// Otherwise create an empty packages index
FileOutputStream out = new FileOutputStream(librariesIndexFile);
out.write("{ \"libraries\" : [ ] }".getBytes());
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
librariesIndexer.parseIndex();
}