Skip to content

Commit 208f934

Browse files
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 8502343 commit 208f934

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

app/src/processing/app/SketchController.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import cc.arduino.CompilerProgressListener;
2828
import cc.arduino.UploaderUtils;
2929
import cc.arduino.packages.Uploader;
30-
import org.apache.commons.codec.digest.DigestUtils;
3130
import processing.app.debug.RunnerException;
3231
import processing.app.forms.PasswordAuthorizationDialog;
3332
import processing.app.helpers.FileUtils;

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

Lines changed: 2 additions & 4 deletions
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)