MCPcopy Index your code
hub / github.com/processing/processing / fileSelected

Method fileSelected

app/src/processing/app/tools/Archiver.java:105–136  ·  view source on GitHub ↗
(File newbie)

Source from the content-addressed store, hash-verified

103
104
105 public void fileSelected(File newbie) {
106 if (newbie != null) {
107 try {
108 // Force a .zip extension
109 // https://github.com/processing/processing/issues/2526
110 if (!newbie.getName().toLowerCase().endsWith(".zip")) {
111 newbie = new File(newbie.getAbsolutePath() + ".zip");
112 }
113 //System.out.println(newbie);
114 FileOutputStream zipOutputFile = new FileOutputStream(newbie);
115 ZipOutputStream zos = new ZipOutputStream(zipOutputFile);
116
117 // recursively fill the zip file
118 File sketchFolder = editor.getSketch().getFolder();
119 buildZip(sketchFolder, sketchFolder.getName(), zos);
120
121 // close up the jar file
122 zos.flush();
123 zos.close();
124
125 final String msg =
126 Language.interpolate("editor.status.archiver.create",
127 newbie.getName());
128 editor.statusNotice(msg);
129
130 } catch (IOException e) {
131 e.printStackTrace();
132 }
133 } else {
134 editor.statusNotice(Language.text("editor.status.archiver.cancel"));
135 }
136 }
137
138
139 private void buildZip(File dir, String sofar,

Callers

nothing calls this directly

Calls 10

buildZipMethod · 0.95
interpolateMethod · 0.95
textMethod · 0.95
getSketchMethod · 0.80
statusNoticeMethod · 0.65
getNameMethod · 0.45
getFolderMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45
printStackTraceMethod · 0.45

Tested by

no test coverage detected