@@ -90,7 +90,7 @@ public static void startup_Pluging(IProgressMonitor monitor) {
9090 loadJsons (ConfigurationPreferences .getUpdateJasonFilesFlag ());
9191 List <Board > allBoards = getInstalledBoards ();
9292 if (allBoards .isEmpty ()) { // If boards are installed do nothing
93- // InstallDefaultLibraries(monitor);
93+ InstallDefaultLibraries (monitor );
9494 MyMultiStatus mstatus = new MyMultiStatus ("Failed to configer Sloeber" ); //$NON-NLS-1$
9595
9696 // Downnload sample programs
@@ -123,14 +123,18 @@ public static void startup_Pluging(IProgressMonitor monitor) {
123123
124124 }
125125
126- /*
127- * private static void InstallDefaultLibraries(IProgressMonitor monitor) {
128- * LibraryIndex libindex = getLibraryIndex();
129- *
130- * for (String library : Defaults.INSTALLED_LIBRARIES) { Library toInstalLib
131- * = libindex.getLatestLibrary(library); if (toInstalLib != null) {
132- * toInstalLib.install(monitor); } } }
133- */
126+ private static void InstallDefaultLibraries (IProgressMonitor monitor ) {
127+ LibraryIndex libindex = getLibraryIndex (Defaults .DEFAULT );
128+ if (libindex == null )
129+ return ;
130+
131+ for (String library : Defaults .INSTALLED_LIBRARIES ) {
132+ Library toInstalLib = libindex .getLatestLibrary (library );
133+ if (toInstalLib != null ) {
134+ toInstalLib .install (monitor );
135+ }
136+ }
137+ }
134138
135139 /**
136140 * Given a platform description in a json file download and install all
@@ -230,9 +234,9 @@ static private void loadJson(String url, boolean forceDownload) {
230234 }
231235 }
232236 if (jsonFile .exists ()) {
233- if (jsonFile .getName ().startsWith ("package_" )) { //$NON-NLS-1$
237+ if (jsonFile .getName ().toLowerCase (). startsWith ("package_" )) { //$NON-NLS-1$
234238 loadPackage (jsonFile );
235- } else if (jsonFile .getName ().startsWith ("library_" )) { //$NON-NLS-1$
239+ } else if (jsonFile .getName ().toLowerCase (). startsWith ("library_" )) { //$NON-NLS-1$
236240 loadLibrary (jsonFile );
237241 }
238242 }
@@ -255,7 +259,6 @@ static private void loadLibrary(File jsonFile) {
255259 try (Reader reader = new FileReader (jsonFile )) {
256260 LibraryIndex index = new Gson ().fromJson (reader , LibraryIndex .class );
257261 index .resolve ();
258- // index.setOwners(null);
259262 index .setJsonFile (jsonFile );
260263 libraryIndices .add (index );
261264 } catch (Exception e ) {
@@ -278,6 +281,15 @@ static public List<LibraryIndex> getLibraryIndices() {
278281 }
279282 return libraryIndices ;
280283 }
284+
285+ static public LibraryIndex getLibraryIndex (String name ) {
286+ for (LibraryIndex index : getLibraryIndices ()) {
287+ if (index .getName ().equals (name )) {
288+ return index ;
289+ }
290+ }
291+ return null ;
292+ }
281293
282294 static public Board getBoard (String boardName , String platformName , String packageName ) {
283295 for (PackageIndex index : getPackageIndices ()) {
@@ -772,7 +784,7 @@ public static int compareVersions(String version1, String version2) {
772784 if (vi1 > vi2 ) {
773785 return 1 ;
774786 }
775- } catch (NumberFormatException e ) {
787+ } catch (@ SuppressWarnings ( "unused" ) NumberFormatException e ) {
776788 // not numbers, do string compares
777789 int c = v1 [i ].compareTo (v2 [i ]);
778790 if (c < 0 ) {
0 commit comments