Skip to content

Commit e907ee4

Browse files
Move sketch deletion from SketchController into Sketch
This isn't much code, but it makes deletion more consistent with renaming and saving with the SketchController handling the UI part and Sketch actually doing the delete.
1 parent 5cd266c commit e907ee4

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

app/src/processing/app/SketchController.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -250,20 +250,8 @@ public void handleDeleteCode() throws IOException {
250250
options[0]);
251251
if (result == JOptionPane.YES_OPTION) {
252252
if (current.isPrimary()) {
253-
// need to unset all the modified flags, otherwise tries
254-
// to do a save on the handleNew()
255-
256-
// delete the entire sketch
257-
FileUtils.recursiveDelete(sketch.getFolder());
258-
259-
// get the changes into the sketchbook menu
260-
//sketchbook.rebuildMenus();
261-
262-
// make a new sketch, and i think this will rebuild the sketch menu
263-
//editor.handleNewUnchecked();
264-
//editor.handleClose2();
253+
sketch.delete();
265254
editor.base.handleClose(editor);
266-
267255
} else {
268256
// delete the file
269257
if (!current.deleteFile(BaseNoGui.getBuildFolder(sketch).toPath())) {

arduino-core/src/processing/app/Sketch.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,4 +332,11 @@ public void saveAs(File newFolder) throws IOException {
332332
FileUtils.copy(getDataFolder(), newDataFolder);
333333
}
334334
}
335+
336+
/**
337+
* Deletes this entire sketch from disk.
338+
*/
339+
void delete() {
340+
FileUtils.recursiveDelete(folder);
341+
}
335342
}

0 commit comments

Comments
 (0)