From 59b70c83730126ea13b663c1114a58d30bcfe6b9 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 29 Dec 2015 17:47:48 +0100 Subject: [PATCH] Randomize the the build path name Previously, this used a hash of the sketch filename, so the same build path would be generated for the same sketch between multiple compilations. Now that the build path is stored, this requirement has disappeared, so a random filename can be generated again. While here, this commit also changes the prefix from "build" to "arduino_build_", which makes it a bit more clear what the directory's purpose is. --- arduino-core/src/processing/app/Sketch.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arduino-core/src/processing/app/Sketch.java b/arduino-core/src/processing/app/Sketch.java index 6e0078f21..41e6484b1 100644 --- a/arduino-core/src/processing/app/Sketch.java +++ b/arduino-core/src/processing/app/Sketch.java @@ -7,8 +7,6 @@ import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.apache.commons.codec.digest.DigestUtils; - import cc.arduino.files.DeleteFilesOnShutdown; import processing.app.helpers.FileUtils; @@ -174,7 +172,7 @@ public class Sketch { * * This takes into account the build.path preference. If it is set, * that path is always returned, and the directory is *not* deleted on - * shutdown. If the preference is not set, a pathname in a + * shutdown. If the preference is not set, a random pathname in a * temporary directory is generated, which is automatically deleted on * shutdown. */ @@ -184,7 +182,7 @@ public class Sketch { buildPath = BaseNoGui.absoluteFile(PreferencesData.get("build.path")); Files.createDirectories(buildPath.toPath()); } else { - buildPath = FileUtils.createTempFolder("build", DigestUtils.md5Hex(getMainFilePath()) + ".tmp"); + buildPath = FileUtils.createTempFolder("arduino_build_"); DeleteFilesOnShutdown.add(buildPath); } }