MCPcopy
hub / github.com/arduino/Arduino / findClassInZipFile

Method findClassInZipFile

app/src/processing/app/Editor.java:910–946  ·  view source on GitHub ↗
(String base, File file)

Source from the content-addressed store, hash-verified

908
909
910 private String findClassInZipFile(String base, File file) {
911 // Class file to search for
912 String classFileName = "/" + base + ".class";
913
914 ZipFile zipFile = null;
915 try {
916 zipFile = new ZipFile(file);
917 Enumeration<?> entries = zipFile.entries();
918 while (entries.hasMoreElements()) {
919 ZipEntry entry = (ZipEntry) entries.nextElement();
920
921 if (!entry.isDirectory()) {
922 String name = entry.getName();
923 //System.out.println("entry: " + name);
924
925 if (name.endsWith(classFileName)) {
926 //int slash = name.lastIndexOf('/');
927 //String packageName = (slash == -1) ? "" : name.substring(0, slash);
928 // Remove .class and convert slashes to periods.
929 return name.substring(0, name.length() - 6).replace('/', '.');
930 }
931 }
932 }
933 } catch (IOException e) {
934 //System.err.println("Ignoring " + filename + " (" + e.getMessage() + ")");
935 e.printStackTrace();
936 } finally {
937 if (zipFile != null) {
938 try {
939 zipFile.close();
940 } catch (IOException e) {
941 // noop
942 }
943 }
944 }
945 return null;
946 }
947
948 public void updateKeywords(PdeKeywords keywords) {
949 for (EditorTab tab : tabs)

Callers 1

addToolsMethod · 0.95

Calls 4

replaceMethod · 0.80
printStackTraceMethod · 0.80
getNameMethod · 0.65
closeMethod · 0.45

Tested by

no test coverage detected