mirror of https://github.com/noisymime/Arduino.git
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:
parent
4f0af2af57
commit
59b70c8373
|
@ -7,8 +7,6 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
|
||||||
|
|
||||||
import cc.arduino.files.DeleteFilesOnShutdown;
|
import cc.arduino.files.DeleteFilesOnShutdown;
|
||||||
import processing.app.helpers.FileUtils;
|
import processing.app.helpers.FileUtils;
|
||||||
|
|
||||||
|
@ -174,7 +172,7 @@ public class Sketch {
|
||||||
*
|
*
|
||||||
* This takes into account the build.path preference. If it is set,
|
* This takes into account the build.path preference. If it is set,
|
||||||
* that path is always returned, and the directory is *not* deleted on
|
* 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
|
* temporary directory is generated, which is automatically deleted on
|
||||||
* shutdown.
|
* shutdown.
|
||||||
*/
|
*/
|
||||||
|
@ -184,7 +182,7 @@ public class Sketch {
|
||||||
buildPath = BaseNoGui.absoluteFile(PreferencesData.get("build.path"));
|
buildPath = BaseNoGui.absoluteFile(PreferencesData.get("build.path"));
|
||||||
Files.createDirectories(buildPath.toPath());
|
Files.createDirectories(buildPath.toPath());
|
||||||
} else {
|
} else {
|
||||||
buildPath = FileUtils.createTempFolder("build", DigestUtils.md5Hex(getMainFilePath()) + ".tmp");
|
buildPath = FileUtils.createTempFolder("arduino_build_");
|
||||||
DeleteFilesOnShutdown.add(buildPath);
|
DeleteFilesOnShutdown.add(buildPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue