(String path)
| 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) { |
no test coverage detected