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

Method openSketchBundle

app/src/processing/app/Base.java:1214–1242  ·  view source on GitHub ↗
(String path)

Source from the content-addressed store, hash-verified

1212
1213
1214 private Editor openSketchBundle(String path) {
1215 File zipFile = new File(path);
1216 try {
1217 File destFolder = File.createTempFile("zip", "tmp", untitledFolder);
1218 if (!destFolder.delete() || !destFolder.mkdirs()) {
1219 // Hard to imagine why this would happen, but...
1220 System.err.println("Could not create temporary folder " + destFolder);
1221 return null;
1222 }
1223 Util.unzip(zipFile, destFolder);
1224 File[] fileList = destFolder.listFiles(File::isDirectory);
1225 if (fileList != null) {
1226 if (fileList.length == 1) {
1227 File sketchFile = Sketch.findMain(fileList[0], getModeList());
1228 if (sketchFile != null) {
1229 return handleOpenUntitled(sketchFile.getAbsolutePath());
1230 }
1231 } else {
1232 System.err.println("Expecting one folder inside " +
1233 SKETCH_BUNDLE_EXT + " file, found " + fileList.length + ".");
1234 }
1235 } else {
1236 System.err.println("Could not read " + destFolder);
1237 }
1238 } catch (IOException e) {
1239 e.printStackTrace();
1240 }
1241 return null; // no luck
1242 }
1243
1244
1245 private void openContribBundle(String path) {

Callers 1

handleOpenMethod · 0.95

Calls 9

unzipMethod · 0.95
findMainMethod · 0.95
getModeListMethod · 0.95
handleOpenUntitledMethod · 0.95
createTempFileMethod · 0.80
deleteMethod · 0.45
printlnMethod · 0.45
listFilesMethod · 0.45
printStackTraceMethod · 0.45

Tested by

no test coverage detected