MCPcopy Index your code
hub / github.com/benfry/processing4 / packageListFromZip

Method packageListFromZip

app/src/processing/app/Util.java:625–651  ·  view source on GitHub ↗
(String filename, StringList list)

Source from the content-addressed store, hash-verified

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 /**

Callers 1

Calls 7

getMessageMethod · 0.65
entriesMethod · 0.45
getNameMethod · 0.45
containsMethod · 0.45
appendUniqueMethod · 0.45
closeMethod · 0.45
printlnMethod · 0.45

Tested by

no test coverage detected