(String pkgName)
| 403 | |
| 404 | |
| 405 | public Library getLibrary(String pkgName) throws SketchException { |
| 406 | List<Library> libraries = importToLibraryTable.get(pkgName); |
| 407 | if (libraries == null) { |
| 408 | return null; |
| 409 | |
| 410 | } else if (libraries.size() > 1) { |
| 411 | String primary = "More than one library is competing for this sketch."; |
| 412 | String secondary = "The import " + pkgName + " points to multiple libraries:<br>"; |
| 413 | for (Library library : libraries) { |
| 414 | String location = library.getPath(); |
| 415 | if (location.startsWith(getLibrariesFolder().getAbsolutePath())) { |
| 416 | location = "part of Processing"; |
| 417 | } |
| 418 | secondary += "<b>" + library.getName() + "</b> (" + location + ")<br>"; |
| 419 | } |
| 420 | secondary += "Extra libraries need to be removed before this sketch can be used."; |
| 421 | Messages.showWarningTiered("Duplicate Library Problem", primary, secondary, null); |
| 422 | throw new SketchException("Duplicate libraries found for " + pkgName + "."); |
| 423 | |
| 424 | } else { |
| 425 | return libraries.get(0); |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | |
| 430 | // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
no test coverage detected