(String filename, StringList list)
| 623 | |
| 624 | |
| 625 | static private void packageListFromZip(String filename, StringList list) { |
| 626 | try { |
| 627 | ZipFile file = new ZipFile(filename); |
| 628 | Enumeration<?> entries = file.entries(); |
| 629 | while (entries.hasMoreElements()) { |
| 630 | ZipEntry entry = (ZipEntry) entries.nextElement(); |
| 631 | |
| 632 | if (!entry.isDirectory()) { |
| 633 | String name = entry.getName(); |
| 634 | |
| 635 | // Avoid META-INF because some jokers put .class files in there |
| 636 | // https://github.com/processing/processing/issues/5778 |
| 637 | if (name.endsWith(".class") && !name.contains("META-INF/")) { |
| 638 | int slash = name.lastIndexOf('/'); |
| 639 | if (slash != -1) { |
| 640 | String packageName = name.substring(0, slash); |
| 641 | list.appendUnique(packageName); |
| 642 | } |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | file.close(); |
| 647 | } catch (IOException e) { |
| 648 | System.err.println("Ignoring " + filename + " (" + e.getMessage() + ")"); |
| 649 | //e.printStackTrace(); |
| 650 | } |
| 651 | } |
| 652 | |
| 653 | |
| 654 | /** |
no test coverage detected