1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-28 09:24:14 +01:00

Store temporary sketch in a folder named as the sketch

Previously the sketch was saved directly in the temporary folder:

  /tmp/arduino_modified_sketch_66288/Blink.ino

this is not a correct Arduino sketch, now it is saved in:

  /tmp/arduino_modified_sketch_66288/Blink/Blink.ino
This commit is contained in:
Cristian Maglie 2020-07-16 18:30:11 +02:00
parent 95ccb804d5
commit c62f62c9dc

View File

@ -671,7 +671,11 @@ public class SketchController {
}
private File saveSketchInTempFolder() throws IOException {
File tempFolder = FileUtils.createTempFolder("arduino_modified_sketch_");
File temp = FileUtils.createTempFolder("arduino_modified_sketch_");
File tempFolder = new File(temp, getSketch().getName());
if (!tempFolder.mkdir()) {
throw new IOException("Can't create directory to store temp sketch.");
}
FileUtils.copy(sketch.getFolder(), tempFolder);
for (SketchFile file : Stream.of(sketch.getFiles()).filter(SketchFile::isModified).collect(Collectors.toList())) {