mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-10 21:24:12 +01:00
Files weren't deleted from temp unsaved sketch folder. Fixes #4233
This commit is contained in:
parent
aaebb0a4d6
commit
e224698ecf
@ -463,7 +463,7 @@ public class Sketch {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// delete the file
|
// delete the file
|
||||||
if (!current.getCode().deleteFile(BaseNoGui.getBuildFolder(data))) {
|
if (!current.getCode().deleteFile(BaseNoGui.getBuildFolder(data).toPath(), Paths.get(System.getProperty("java.io.tmpdir"), "arduino_" + DigestUtils.md5Hex(getMainFilePath())))) {
|
||||||
Base.showMessage(tr("Couldn't do it"),
|
Base.showMessage(tr("Couldn't do it"),
|
||||||
I18n.format(tr("Could not delete \"{0}\"."), current.getCode().getFileName()));
|
I18n.format(tr("Could not delete \"{0}\"."), current.getCode().getFileName()));
|
||||||
return;
|
return;
|
||||||
|
@ -91,12 +91,12 @@ public class SketchCode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected boolean deleteFile(File tempBuildFolder) throws IOException {
|
protected boolean deleteFile(Path tempBuildFolder, Path tempUnsavedSketchPath) throws IOException {
|
||||||
if (!file.delete()) {
|
if (!file.delete()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Path> tempBuildFolders = Stream.of(tempBuildFolder.toPath(), Paths.get(tempBuildFolder.getAbsolutePath(), "sketch"))
|
List<Path> tempBuildFolders = Stream.of(tempBuildFolder, tempBuildFolder.resolve("sketch"), tempUnsavedSketchPath)
|
||||||
.filter(path -> Files.exists(path))
|
.filter(path -> Files.exists(path))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user