Skip to content

Commit 0e20b77

Browse files
committed
Use partitions.csv from sketch folder
1 parent 92b4956 commit 0e20b77

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

Diff for: src/ESP32FS.java

+26-17
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ private void createAndUpload(){
206206
String espotaCmd = "espota.py";
207207
if(PreferencesData.get("runtime.os").contentEquals("windows"))
208208
espotaCmd = "espota.exe";
209-
209+
210210
Boolean isNetwork = false;
211211
File espota = new File(platform.getFolder()+"/tools");
212212
File esptool = new File(platform.getFolder()+"/tools");
@@ -217,23 +217,32 @@ private void createAndUpload(){
217217
editor.statusError("Partitions Not Defined for "+BaseNoGui.getBoardPreferences().get("name"));
218218
return;
219219
}
220-
221-
try {
222-
partitions = BaseNoGui.getBoardPreferences().get("build.partitions");
223-
if(partitions == null || partitions.contentEquals("")){
224-
editor.statusError("Partitions Not Found for "+BaseNoGui.getBoardPreferences().get("name"));
225-
return;
226-
}
227-
} catch(Exception e){
228-
editor.statusError(e);
229-
return;
230-
}
231220

232-
File partitionsFile = new File(platform.getFolder() + "/tools/partitions", partitions + ".csv");
233-
if (!partitionsFile.exists() || !partitionsFile.isFile()) {
234-
System.err.println();
235-
editor.statusError(typefs + " Error: partitions file " + partitions + ".csv not found!");
236-
return;
221+
File partitionsFile = new File(editor.getSketch().getFolder(), "partitions.csv");
222+
223+
if (partitionsFile.exists() && partitionsFile.isFile()) {
224+
System.out.println("Using partitions.csv from sketch folder.");
225+
226+
} else {
227+
System.out.println("Using partition scheme from Arduino IDE.");
228+
try {
229+
partitions = BaseNoGui.getBoardPreferences().get("build.partitions");
230+
if(partitions == null || partitions.contentEquals("")){
231+
editor.statusError("Partitions Not Found for "+BaseNoGui.getBoardPreferences().get("name"));
232+
return;
233+
}
234+
} catch(Exception e){
235+
editor.statusError(e);
236+
return;
237+
}
238+
239+
partitionsFile = new File(platform.getFolder() + "/tools/partitions", partitions + ".csv");
240+
241+
if (!partitionsFile.exists() || !partitionsFile.isFile()) {
242+
System.err.println();
243+
editor.statusError(typefs + " Error: partitions file " + partitions + ".csv not found!");
244+
return;
245+
}
237246
}
238247

239248
try {

0 commit comments

Comments
 (0)