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

Method contentsToClassPath

app/src/processing/app/Util.java:468–500  ·  view source on GitHub ↗

Given a folder, return a list of absolute paths to all jar or zip files inside that folder, separated by pathSeparatorChar. This will prepend a colon (or whatever the path separator is) so that it can be directly appended to another path string. As of 0136, this will no longer add the root folder

(File folder)

Source from the content-addressed store, hash-verified

466 * files in the folder or within a subfolder.
467 */
468 static public String contentsToClassPath(File folder) {
469 if (folder == null) return "";
470
471 StringBuilder sb = new StringBuilder();
472 String sep = System.getProperty("path.separator");
473
474 try {
475 String path = folder.getCanonicalPath();
476
477 // When getting the name of this folder, make sure it has a slash
478 // after it, so that the names of sub-items can be added.
479 if (!path.endsWith(File.separator)) {
480 path += File.separator;
481 }
482
483 String list[] = folder.list();
484 for (int i = 0; i < list.length; i++) {
485 // Skip . and ._ files. Prior to 0125p3, .jar files that had
486 // OS X AppleDouble files associated would cause trouble.
487 if (list[i].startsWith(".")) continue;
488
489 if (list[i].toLowerCase().endsWith(".jar") ||
490 list[i].toLowerCase().endsWith(".zip")) {
491 sb.append(sep);
492 sb.append(path);
493 sb.append(list[i]);
494 }
495 }
496 } catch (IOException e) {
497 e.printStackTrace(); // this would be odd
498 }
499 return sb.toString();
500 }
501
502
503 /**

Callers 4

preprocessMethod · 0.95
exportApplicationMethod · 0.95

Calls 5

startsWithMethod · 0.80
listMethod · 0.45
appendMethod · 0.45
printStackTraceMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected