mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-28 09:24:14 +01:00
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.
This commit is contained in:
parent
85d48394a4
commit
ccec28ea45
@ -249,20 +249,8 @@ public class SketchController {
|
|||||||
options[0]);
|
options[0]);
|
||||||
if (result == JOptionPane.YES_OPTION) {
|
if (result == JOptionPane.YES_OPTION) {
|
||||||
if (current.isPrimary()) {
|
if (current.isPrimary()) {
|
||||||
// need to unset all the modified flags, otherwise tries
|
sketch.delete();
|
||||||
// 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();
|
|
||||||
editor.base.handleClose(editor);
|
editor.base.handleClose(editor);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// delete the file
|
// delete the file
|
||||||
if (!current.deleteFile(BaseNoGui.getBuildFolder(sketch).toPath())) {
|
if (!current.deleteFile(BaseNoGui.getBuildFolder(sketch).toPath())) {
|
||||||
|
@ -332,4 +332,11 @@ public class Sketch {
|
|||||||
FileUtils.copy(getDataFolder(), newDataFolder);
|
FileUtils.copy(getDataFolder(), newDataFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes this entire sketch from disk.
|
||||||
|
*/
|
||||||
|
void delete() {
|
||||||
|
FileUtils.recursiveDelete(folder);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user