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.
This commit is contained in:
Matthijs Kooijman 2015-12-29 17:47:48 +01:00 committed by Martino Facchin
parent 4f0af2af57
commit 59b70c8373
1 changed files with 2 additions and 4 deletions

View File

@ -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);
}
}