@@ -112,8 +112,8 @@ public TreeMap<String, String> getMenus() {
112
112
}
113
113
114
114
/**
115
- * Get all the acceptable values for a option for a board The outcome of
116
- * this method can be used to fill a
115
+ * Get all the acceptable values for a option for a board The outcome of this
116
+ * method can be used to fill a
117
117
*
118
118
* @param menu
119
119
* the id of a menu not the name
@@ -143,8 +143,8 @@ public String[] getMenuItemNamesFromMenuID(String menuID, String boardID) {
143
143
}
144
144
145
145
/**
146
- * Get all the acceptable values for a option for a board The outcome of
147
- * this method can be used to fill a
146
+ * Get all the acceptable values for a option for a board The outcome of this
147
+ * method can be used to fill a
148
148
*
149
149
* @param menu
150
150
* the id of a menu not the name
@@ -185,13 +185,13 @@ public String[] getAllNames() {
185
185
}
186
186
187
187
/**
188
- * getAllNames returns all the "names" that are in the currently loaded
189
- * *.txt file. The toaddNames are added to the end result toaddNames should
190
- * be a string array and can not be null
188
+ * getAllNames returns all the "names" that are in the currently loaded *.txt
189
+ * file. The toaddNames are added to the end result toaddNames should be a
190
+ * string array and can not be null
191
191
*
192
- * For a boards.txt file that means all the board names. For a
193
- * programmers.txt file that means all the programmers For platform.txt the
194
- * outcome is not defined
192
+ * For a boards.txt file that means all the board names. For a programmers.txt
193
+ * file that means all the programmers For platform.txt the outcome is not
194
+ * defined
195
195
*
196
196
* @return an empty list if no board file is loaded. In all other cases it
197
197
* returns the list of boards found in the file
@@ -270,8 +270,8 @@ private boolean LoadBoardsFile() {
270
270
271
271
/**
272
272
* Given a nice name look for the ID The assumption is that the txt file
273
- * contains a line like ID.name=[nice name] Given this this method returns
274
- * ID when given [nice name]
273
+ * contains a line like ID.name=[nice name] Given this this method returns ID
274
+ * when given [nice name]
275
275
*/
276
276
public String getBoardIDFromBoardName (String name ) {
277
277
if ((name == null ) || name .isEmpty ()) {
@@ -318,8 +318,8 @@ static public void load(File inputFile, Map<String, String> table) throws IOExce
318
318
}
319
319
320
320
/**
321
- * Loads an input stream into an array of strings representing each line of
322
- * the input stream
321
+ * Loads an input stream into an array of strings representing each line of the
322
+ * input stream
323
323
*
324
324
* @param input
325
325
* the input stream to load
@@ -408,29 +408,34 @@ public String getNameFromID(String myBoardID) {
408
408
}
409
409
410
410
/*
411
- * Returns the package name based on the boardsfile name Caters for the
412
- * packages (with version number and for the old way
411
+ * Returns the package name based on the boardsfile name Caters for the packages
412
+ * (with version number and for the old way
413
+ * if the boards file does not exists returns arduino
413
414
*/
414
415
public String getPackage () {
415
- IPath platformFile = new Path (this .mLastLoadedTxtFile .toString ().trim ());
416
- String architecture = platformFile .removeLastSegments (1 ).lastSegment ();
417
- if (architecture .contains (Const .DOT )) { // This is a version number so
418
- // package
419
- return platformFile .removeLastSegments (4 ).lastSegment ();
416
+ if (this .mLastLoadedTxtFile .exists ()) {
417
+ IPath platformFile = new Path (this .mLastLoadedTxtFile .toString ().trim ());
418
+ String architecture = platformFile .removeLastSegments (1 ).lastSegment ();
419
+ if (architecture .contains (Const .DOT )) { // This is a version number so
420
+ // package
421
+ return platformFile .removeLastSegments (4 ).lastSegment ();
422
+ }
423
+ return platformFile .removeLastSegments (2 ).lastSegment ();
420
424
}
421
- return platformFile . removeLastSegments ( 2 ). lastSegment ();
425
+ return "arduino" ; //$NON-NLS-1$
422
426
}
423
427
424
428
/*
425
429
* Returns the architecture based on the platform file name Caters for the
426
430
* packages (with version number and for the old way
431
+ * if the boards file does not exists returns avr
427
432
*/
428
433
public String getArchitecture () {
429
434
430
435
IPath platformFile = new Path (this .mLastLoadedTxtFile .toString ().trim ());
431
436
String architecture = platformFile .removeLastSegments (1 ).lastSegment ();
432
- if (architecture == null ) {//for error conditions
433
- architecture = "avr" ; //$NON-NLS-1$
437
+ if (architecture == null ) {// for error conditions
438
+ architecture = "avr" ; //$NON-NLS-1$
434
439
}
435
440
if (architecture .contains (Const .DOT )) { // This is a version number so
436
441
// package
0 commit comments