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

Deleting tab from IDE does not delete from temporary folder. Fixes #1161

This commit is contained in:
Cristian Maglie 2012-12-15 12:32:53 +01:00
commit 69bc5369f3
2 changed files with 16 additions and 3 deletions

View File

@ -612,7 +612,7 @@ public class Sketch {
} else {
// delete the file
if (!current.deleteFile()) {
if (!current.deleteFile(tempBuildFolder)) {
Base.showMessage(_("Couldn't do it"),
I18n.format(_("Could not delete \"{0}\"."), current.getFileName()));
return;

View File

@ -107,8 +107,21 @@ public class SketchCode {
}
protected boolean deleteFile() {
return file.delete();
protected boolean deleteFile(File tempBuildFolder) {
if (!file.delete()) {
return false;
}
File[] compiledFiles = tempBuildFolder.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return pathname.getName().startsWith(getFileName());
}
});
for (File compiledFile : compiledFiles) {
compiledFile.delete();
}
return true;
}