mirror of
https://github.com/processing/processing4.git
synced 2026-02-14 02:45:36 +01:00
Fixed issue 843: "Prefix too short" for temp files
This commit is contained in:
@@ -1778,8 +1778,16 @@ public class Base {
|
||||
* Create a temporary folder by using the createTempFile() mechanism,
|
||||
* deleting the file it creates, and making a folder using the location
|
||||
* that was provided.
|
||||
*
|
||||
* Unlike createTempFile(), there is no minimum size for prefix. If
|
||||
* prefix is less than 3 characters, the remaining characters will be
|
||||
* filled with underscores
|
||||
*/
|
||||
static public File createTempFolder(String prefix, String suffix) throws IOException {
|
||||
int fillChars = 3 - prefix.length();
|
||||
for (int i = 0; i < fillChars; i++) {
|
||||
prefix += '_';
|
||||
}
|
||||
File folder = File.createTempFile(prefix, suffix);
|
||||
// Now delete that file and create a folder in its place
|
||||
folder.delete();
|
||||
|
||||
Reference in New Issue
Block a user