From 86d20b87264a40a2b8e624456eb1255893341cd5 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Fri, 18 Dec 2015 15:13:54 +0100 Subject: [PATCH] Do not store the "data" folder in Sketch Instead, just the File object when requested. It is not used during normal operation (just when adding files, or using save as), so no point in already creating the object in the constructor. --- arduino-core/src/processing/app/Sketch.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arduino-core/src/processing/app/Sketch.java b/arduino-core/src/processing/app/Sketch.java index 1526b3a5d..5873f4bed 100644 --- a/arduino-core/src/processing/app/Sketch.java +++ b/arduino-core/src/processing/app/Sketch.java @@ -30,11 +30,6 @@ public class Sketch { */ private File folder; - /** - * data folder location for this sketch (may not exist yet) - */ - private File dataFolder; - /** * Name of sketch, which is the name of main file (without .pde or .java * extension) @@ -71,7 +66,6 @@ public class Sketch { name = mainFilename.substring(0, mainFilename.length() - suffixLength); folder = new File(file.getParent()); - dataFolder = new File(folder, "data"); files = listSketchFiles(true); } @@ -146,6 +140,7 @@ public class Sketch { * about to be used. */ public File prepareDataFolder() { + File dataFolder = getDataFolder(); if (!dataFolder.exists()) { dataFolder.mkdirs(); } @@ -214,7 +209,7 @@ public class Sketch { } public File getDataFolder() { - return dataFolder; + return new File(folder, "data"); } /**