Skip to content

Commit 59b70c8

Browse files
matthijskooijmanfacchinm
authored andcommitted
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.
1 parent 4f0af2a commit 59b70c8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

arduino-core/src/processing/app/Sketch.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import java.util.stream.Collectors;
88
import java.util.stream.Stream;
99

10-
import org.apache.commons.codec.digest.DigestUtils;
11-
1210
import cc.arduino.files.DeleteFilesOnShutdown;
1311
import processing.app.helpers.FileUtils;
1412

@@ -174,7 +172,7 @@ public SketchFile getFile(int i) {
174172
*
175173
* This takes into account the build.path preference. If it is set,
176174
* that path is always returned, and the directory is *not* deleted on
177-
* shutdown. If the preference is not set, a pathname in a
175+
* shutdown. If the preference is not set, a random pathname in a
178176
* temporary directory is generated, which is automatically deleted on
179177
* shutdown.
180178
*/
@@ -184,7 +182,7 @@ public File getBuildPath() throws IOException {
184182
buildPath = BaseNoGui.absoluteFile(PreferencesData.get("build.path"));
185183
Files.createDirectories(buildPath.toPath());
186184
} else {
187-
buildPath = FileUtils.createTempFolder("build", DigestUtils.md5Hex(getMainFilePath()) + ".tmp");
185+
buildPath = FileUtils.createTempFolder("arduino_build_");
188186
DeleteFilesOnShutdown.add(buildPath);
189187
}
190188
}

0 commit comments

Comments
 (0)