@@ -40,16 +40,25 @@ public class ConfigurationPreferences {
40
40
private static final String PRE_PROCESSING_BOARDS_TXT = "pre_processing_boards.txt" ; //$NON-NLS-1$
41
41
private static final String POST_PROCESSING_BOARDS_TXT = "post_processing_boards.txt" ; //$NON-NLS-1$
42
42
private static final String KEY_UPDATE_JASONS = "Update jsons files" ; //$NON-NLS-1$
43
- private static final String KEY_MANAGER_JSON_URLS = "Arduino Manager board Urls" ; //$NON-NLS-1$
43
+ private static final String KEY_MANAGER_JSON_URLS_V3 = "Arduino Manager board Urls" ; //$NON-NLS-1$
44
+ private static final String KEY_MANAGER_ARDUINO_LIBRARY_JSON_URL = "http://downloads.arduino.cc/libraries/library_index.json" ; //$NON-NLS-1$
45
+ private static final String KEY_MANAGER_JSON_URLS = "Manager jsons" ; //$NON-NLS-1$
44
46
private static final String DEFAULT_JSON_URLS = "http://downloads.arduino.cc/packages/package_index.json" //$NON-NLS-1$
45
- + System .lineSeparator () + "http://arduino.esp8266.com/stable/package_esp8266com_index.json" //$NON-NLS-1$
46
- + System .lineSeparator () + "http://downloads.arduino.cc/libraries/library_index.json" ; //$NON-NLS-1$
47
+ // + System.lineSeparator() +
48
+ // "http://arduino.esp8266.com/stable/package_esp8266com_index.json"
49
+ // //$NON-NLS-1$
50
+ + System .lineSeparator () + KEY_MANAGER_ARDUINO_LIBRARY_JSON_URL ;
47
51
// preference nodes
48
52
public static final String NODE_ARDUINO = Activator .NODE_ARDUINO ;
49
53
50
54
private ConfigurationPreferences () {
51
55
}
52
56
57
+ private static void removeKey (String key ) {
58
+ IEclipsePreferences myScope = ConfigurationScope .INSTANCE .getNode (NODE_ARDUINO );
59
+ myScope .remove (key );
60
+ }
61
+
53
62
private static String getString (String key , String defaultValue ) {
54
63
IEclipsePreferences myScope = ConfigurationScope .INSTANCE .getNode (NODE_ARDUINO );
55
64
return myScope .get (key , defaultValue );
@@ -144,7 +153,24 @@ public static File getPostProcessingBoardsFile() {
144
153
}
145
154
146
155
public static String getJsonURLs () {
147
- return getString (KEY_MANAGER_JSON_URLS , DEFAULT_JSON_URLS );
156
+ // TODO I added some code here to get easier from V3 to V4
157
+ // the library json url is now managed as the boards url's so it also
158
+ // needs to be added to the json url's
159
+ // this is doen in the default but people who have installed other
160
+ // boards or do not move to the default (which is by default)
161
+ // wil not see libraries
162
+ // to fix this I changed the storage name and if the new storage name is
163
+ // empty I read the ol one and add the lib
164
+ String ret = getString (KEY_MANAGER_JSON_URLS , DEFAULT_JSON_URLS );
165
+ if (DEFAULT_JSON_URLS .equals (ret )) {
166
+ ret = getString (KEY_MANAGER_JSON_URLS_V3 , DEFAULT_JSON_URLS );
167
+ if (!DEFAULT_JSON_URLS .equals (ret )) {
168
+ ret += System .lineSeparator () + KEY_MANAGER_ARDUINO_LIBRARY_JSON_URL ;
169
+ setString (KEY_MANAGER_JSON_URLS , ret );
170
+ removeKey (KEY_MANAGER_JSON_URLS_V3 );
171
+ }
172
+ }
173
+ return ret ;
148
174
}
149
175
150
176
public static String getDefaultJsonURLs () {
0 commit comments