MCPcopy Index your code
hub / github.com/processing/processing / discover

Method discover

app/src/processing/app/Library.java:481–516  ·  view source on GitHub ↗
(File folder)

Source from the content-addressed store, hash-verified

479
480
481 static public List<File> discover(File folder) {
482 List<File> libraries = new ArrayList<>();
483 String[] folderNames = folder.list(junkFolderFilter);
484
485 // if a bad folder or unreadable, folderNames might be null
486 if (folderNames != null) {
487 // alphabetize list, since it's not always alpha order
488 // replaced hella slow bubble sort with this feller for 0093
489 Arrays.sort(folderNames, String.CASE_INSENSITIVE_ORDER);
490
491 // TODO some weirdness because ContributionType.LIBRARY.isCandidate()
492 // handles some, but not all, of this [fry 200116]
493 for (String potentialName : folderNames) {
494 File baseFolder = new File(folder, potentialName);
495 File libraryFolder = new File(baseFolder, "library");
496 File libraryJar = new File(libraryFolder, potentialName + ".jar");
497 // If a .jar file of the same prefix as the folder exists
498 // inside the 'library' subfolder of the sketch
499 if (libraryJar.exists()) {
500 String sanityCheck = Sketch.sanitizeName(potentialName);
501 if (sanityCheck.equals(potentialName)) {
502 libraries.add(baseFolder);
503
504 } else {
505 final String mess =
506 "The library \"" + potentialName + "\" cannot be used.\n" +
507 "Library names must contain only basic letters and numbers.\n" +
508 "(ASCII only and no spaces, and it cannot start with a number)";
509 Messages.showMessage("Ignoring bad library name", mess);
510 continue;
511 }
512 }
513 }
514 }
515 return libraries;
516 }
517
518
519 static public List<Library> list(File folder) {

Callers 1

listMethod · 0.95

Calls 6

sanitizeNameMethod · 0.95
showMessageMethod · 0.95
listMethod · 0.45
sortMethod · 0.45
equalsMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected