Skip to content

Commit 69bc536

Browse files
committed
Deleting tab from IDE does not delete from temporary folder. Fixes arduino#1161
2 parents 15a7ebe + 4011f48 commit 69bc536

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

Diff for: app/src/processing/app/Sketch.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ public void handleDeleteCode() {
612612

613613
} else {
614614
// delete the file
615-
if (!current.deleteFile()) {
615+
if (!current.deleteFile(tempBuildFolder)) {
616616
Base.showMessage(_("Couldn't do it"),
617617
I18n.format(_("Could not delete \"{0}\"."), current.getFileName()));
618618
return;

Diff for: app/src/processing/app/SketchCode.java

+15-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,21 @@ protected boolean fileReadOnly() {
107107
}
108108

109109

110-
protected boolean deleteFile() {
111-
return file.delete();
110+
protected boolean deleteFile(File tempBuildFolder) {
111+
if (!file.delete()) {
112+
return false;
113+
}
114+
115+
File[] compiledFiles = tempBuildFolder.listFiles(new FileFilter() {
116+
public boolean accept(File pathname) {
117+
return pathname.getName().startsWith(getFileName());
118+
}
119+
});
120+
for (File compiledFile : compiledFiles) {
121+
compiledFile.delete();
122+
}
123+
124+
return true;
112125
}
113126

114127

0 commit comments

Comments
 (0)