From 48ad7ed769b28979d03f283f57089014c2ae3386 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 27 Feb 2015 14:47:38 +0100 Subject: [PATCH] Added FileUtils.createTempFolderIn(folder) method --- arduino-core/src/processing/app/helpers/FileUtils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arduino-core/src/processing/app/helpers/FileUtils.java b/arduino-core/src/processing/app/helpers/FileUtils.java index 39e49217c..e4a8fdbdb 100644 --- a/arduino-core/src/processing/app/helpers/FileUtils.java +++ b/arduino-core/src/processing/app/helpers/FileUtils.java @@ -83,7 +83,12 @@ public class FileUtils { } public static File createTempFolder() throws IOException { - File tmpFolder = new File(System.getProperty("java.io.tmpdir"), "arduino_" + new Random().nextInt(1000000)); + return createTempFolderIn(new File(System.getProperty("java.io.tmpdir"))); + } + + public static File createTempFolderIn(File parent) throws IOException { + File tmpFolder = new File(parent, "arduino_" + + new Random().nextInt(1000000)); if (!tmpFolder.mkdir()) { throw new IOException("Unable to create temp folder " + tmpFolder); }