Skip to content

Commit b5911c3

Browse files
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.
1 parent 79f5f2b commit b5911c3

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

arduino-core/src/processing/app/Sketch.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ public class Sketch {
3030
*/
3131
private File folder;
3232

33-
/**
34-
* data folder location for this sketch (may not exist yet)
35-
*/
36-
private File dataFolder;
37-
3833
/**
3934
* Name of sketch, which is the name of main file (without .pde or .java
4035
* extension)
@@ -71,7 +66,6 @@ public int compare(SketchFile x, SketchFile y) {
7166
name = mainFilename.substring(0, mainFilename.length() - suffixLength);
7267

7368
folder = new File(file.getParent());
74-
dataFolder = new File(folder, "data");
7569
files = listSketchFiles(true);
7670
}
7771

@@ -146,6 +140,7 @@ private List<SketchFile> listSketchFiles(boolean showWarnings) throws IOExceptio
146140
* about to be used.
147141
*/
148142
public File prepareDataFolder() {
143+
File dataFolder = getDataFolder();
149144
if (!dataFolder.exists()) {
150145
dataFolder.mkdirs();
151146
}
@@ -214,7 +209,7 @@ public File getFolder() {
214209
}
215210

216211
public File getDataFolder() {
217-
return dataFolder;
212+
return new File(folder, "data");
218213
}
219214

220215
/**

0 commit comments

Comments
 (0)