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.
This commit is contained in:
Matthijs Kooijman 2015-12-18 15:13:54 +01:00 committed by Martino Facchin
parent 2d367e757d
commit 86d20b8726
1 changed files with 2 additions and 7 deletions

View File

@ -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");
}
/**