diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index 0293b622f..0b143eb86 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -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; diff --git a/app/src/processing/app/SketchCode.java b/app/src/processing/app/SketchCode.java index 807d479ea..6498cf4ba 100644 --- a/app/src/processing/app/SketchCode.java +++ b/app/src/processing/app/SketchCode.java @@ -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; }