From dedff1320e302902ff1ce94a07f4c314c911129b Mon Sep 17 00:00:00 2001 From: pesckal Date: Mon, 19 Sep 2011 05:24:36 +0000 Subject: [PATCH] Fixed issue 843: "Prefix too short" for temp files --- app/src/processing/app/Base.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 37e6e09fe..3596d41e7 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -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();