From 12a2d872d6af0afb59198b666eb5e1637befe6a2 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 16 May 2014 18:44:33 +0200 Subject: [PATCH] Added empty library_index.json if default is not available. --- arduino-core/src/processing/app/BaseNoGui.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arduino-core/src/processing/app/BaseNoGui.java b/arduino-core/src/processing/app/BaseNoGui.java index f0c5fa113..51b4396ff 100644 --- a/arduino-core/src/processing/app/BaseNoGui.java +++ b/arduino-core/src/processing/app/BaseNoGui.java @@ -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(); }