1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

Handle unsaved tab deletion correctly

This commit is contained in:
Martino Facchin 2018-02-16 09:30:40 +01:00
parent f8540b3a59
commit 950d88dcbe

View File

@ -253,13 +253,21 @@ public class SketchController {
sketch.delete();
editor.base.handleClose(editor);
} else {
boolean neverSavedTab = !current.fileExists();
// delete the file
if (!current.delete(sketch.getBuildPath().toPath())) {
if (!current.delete(sketch.getBuildPath().toPath()) && !neverSavedTab) {
Base.showMessage(tr("Couldn't do it"),
I18n.format(tr("Could not delete \"{0}\"."), current.getFileName()));
return;
}
if (neverSavedTab) {
// remove the file from the sketch list
sketch.removeFile(current);
}
editor.removeTab(current);
// just set current tab to the main tab