mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-13 10:29:35 +01:00
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:
parent
2d367e757d
commit
86d20b8726
@ -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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user