diff --git a/app/src/processing/app/SketchController.java b/app/src/processing/app/SketchController.java index 55321a795..0a0ba6f45 100644 --- a/app/src/processing/app/SketchController.java +++ b/app/src/processing/app/SketchController.java @@ -249,20 +249,8 @@ public class SketchController { options[0]); if (result == JOptionPane.YES_OPTION) { if (current.isPrimary()) { - // need to unset all the modified flags, otherwise tries - // to do a save on the handleNew() - - // delete the entire sketch - FileUtils.recursiveDelete(sketch.getFolder()); - - // get the changes into the sketchbook menu - //sketchbook.rebuildMenus(); - - // make a new sketch, and i think this will rebuild the sketch menu - //editor.handleNewUnchecked(); - //editor.handleClose2(); + sketch.delete(); editor.base.handleClose(editor); - } else { // delete the file if (!current.deleteFile(BaseNoGui.getBuildFolder(sketch).toPath())) { diff --git a/arduino-core/src/processing/app/Sketch.java b/arduino-core/src/processing/app/Sketch.java index ee6dee70e..7c24c5e46 100644 --- a/arduino-core/src/processing/app/Sketch.java +++ b/arduino-core/src/processing/app/Sketch.java @@ -332,4 +332,11 @@ public class Sketch { FileUtils.copy(getDataFolder(), newDataFolder); } } + + /** + * Deletes this entire sketch from disk. + */ + void delete() { + FileUtils.recursiveDelete(folder); + } }