Skip to content

Commit a719652

Browse files
Federico Fissorelmihalkovic
Federico Fissore
authored andcommitted
Files weren't deleted from temp unsaved sketch folder. Fixes arduino#4233
1 parent 9d9af9a commit a719652

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/src/processing/app/Sketch.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ public void handleDeleteCode() throws IOException {
463463

464464
} else {
465465
// delete the file
466-
if (!current.getCode().deleteFile(BaseNoGui.getBuildFolder(data))) {
466+
if (!current.getCode().deleteFile(BaseNoGui.getBuildFolder(data).toPath(), Paths.get(System.getProperty("java.io.tmpdir"), "arduino_" + DigestUtils.md5Hex(getMainFilePath())))) {
467467
Base.showMessage(tr("Couldn't do it"),
468468
I18n.format(tr("Could not delete \"{0}\"."), current.getCode().getFileName()));
469469
return;

arduino-core/src/processing/app/SketchCode.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ protected boolean fileReadOnly() {
9191
}
9292

9393

94-
protected boolean deleteFile(File tempBuildFolder) throws IOException {
94+
protected boolean deleteFile(Path tempBuildFolder, Path tempUnsavedSketchPath) throws IOException {
9595
if (!file.delete()) {
9696
return false;
9797
}
9898

99-
List<Path> tempBuildFolders = Stream.of(tempBuildFolder.toPath(), Paths.get(tempBuildFolder.getAbsolutePath(), "sketch"))
99+
List<Path> tempBuildFolders = Stream.of(tempBuildFolder, tempBuildFolder.resolve("sketch"), tempUnsavedSketchPath)
100100
.filter(path -> Files.exists(path))
101101
.collect(Collectors.toList());
102102

0 commit comments

Comments
 (0)