From c62f62c9dc4063142d020d018d1f12e192e07ddc Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 16 Jul 2020 18:30:11 +0200 Subject: [PATCH] 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 --- app/src/processing/app/SketchController.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/processing/app/SketchController.java b/app/src/processing/app/SketchController.java index 2bb8d4cf8..cea98c53f 100644 --- a/app/src/processing/app/SketchController.java +++ b/app/src/processing/app/SketchController.java @@ -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())) {