(String filename, StringList list)
| 550 | |
| 551 | |
| 552 | static private void packageListFromZip(String filename, StringList list) { |
| 553 | try { |
| 554 | ZipFile file = new ZipFile(filename); |
| 555 | Enumeration<?> entries = file.entries(); |
| 556 | while (entries.hasMoreElements()) { |
| 557 | ZipEntry entry = (ZipEntry) entries.nextElement(); |
| 558 | |
| 559 | if (!entry.isDirectory()) { |
| 560 | String name = entry.getName(); |
| 561 | |
| 562 | // Avoid META-INF because some jokers but .class files in there |
| 563 | // https://github.com/processing/processing/issues/5778 |
| 564 | if (name.endsWith(".class") && !name.startsWith("META-INF/")) { |
| 565 | int slash = name.lastIndexOf('/'); |
| 566 | if (slash != -1) { |
| 567 | String packageName = name.substring(0, slash); |
| 568 | list.appendUnique(packageName); |
| 569 | } |
| 570 | } |
| 571 | } |
| 572 | } |
| 573 | file.close(); |
| 574 | } catch (IOException e) { |
| 575 | System.err.println("Ignoring " + filename + " (" + e.getMessage() + ")"); |
| 576 | //e.printStackTrace(); |
| 577 | } |
| 578 | } |
| 579 | |
| 580 | |
| 581 | /** |
no test coverage detected