1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-30 19:52:13 +01:00

Randomize temporary sketch copy directory name

When a sketch has unsaved changes, a temporary copy of the sketch is
made with those changes applied. This copy is then passed to
arduino-builder.

Previously, the name of this directory contained a hash of the main
sketch filename, so the same directory would be used between builds. Now
that this directory is deleted after every build, it can just use a
randomized directory name, which is what this commit does.

Addtionally, the prefix used for generating the name is changed from
"arduino_" to "arduino_modified_sketch_" to make it slightly clearer
what the directory is for (just in case it somehow survives the build,
or a user sees it during the build).
This commit is contained in:
Matthijs Kooijman 2015-12-28 15:24:17 +01:00
parent 1029e0b78d
commit 7949e7e81f

View File

@ -1119,7 +1119,7 @@ public class Sketch {
}
private String saveSketchInTempFolder() throws IOException {
File tempFolder = FileUtils.createTempFolder("arduino_", DigestUtils.md5Hex(data.getMainFilePath()));
File tempFolder = FileUtils.createTempFolder("arduino_modified_sketch_");
FileUtils.copy(getFolder(), tempFolder);
for (SketchCode sc : Stream.of(data.getCodes()).filter(SketchCode::isModified).collect(Collectors.toList())) {