MCPcopy
hub / github.com/arduino/Arduino / loadTargetPackage

Method loadTargetPackage

arduino-core/src/processing/app/BaseNoGui.java:590–612  ·  view source on GitHub ↗
(TargetPackage targetPackage, File _folder)

Source from the content-addressed store, hash-verified

588 }
589
590 private static void loadTargetPackage(TargetPackage targetPackage, File _folder) throws TargetPlatformException {
591 File[] folders = _folder.listFiles(ONLY_DIRS);
592 if (folders == null) {
593 return;
594 }
595
596 for (File subFolder : folders) {
597 if (!subFolder.exists() || !subFolder.canRead()) {
598 continue;
599 }
600 String arch = subFolder.getName();
601 try {
602 TargetPlatform p = new LegacyTargetPlatform(arch, subFolder, targetPackage);
603 targetPackage.getPlatforms().put(arch, p);
604 } catch (TargetPlatformException e) {
605 System.err.println(e.getMessage());
606 }
607 }
608
609 if (targetPackage.getPlatforms().size() == 0) {
610 throw new TargetPlatformException(I18n.format(tr("No valid hardware definitions found in folder {0}."), _folder.getName()));
611 }
612 }
613
614 /**
615 * Grab the contents of a file as a string.

Callers 1

loadHardwareMethod · 0.95

Calls 9

formatMethod · 0.95
listFilesMethod · 0.80
putMethod · 0.80
sizeMethod · 0.80
trMethod · 0.80
getNameMethod · 0.65
getPlatformsMethod · 0.65
existsMethod · 0.45
getMessageMethod · 0.45

Tested by

no test coverage detected