|
8 | 8 | * Author : $Author$
|
9 | 9 | * Created By : Robert Heller
|
10 | 10 | * Created : Thu Apr 11 09:47:34 2019
|
11 |
| - * Last Modified : <190411.1619> |
| 11 | + * Last Modified : <190412.1023> |
12 | 12 | *
|
13 | 13 | * Description
|
14 | 14 | *
|
@@ -303,6 +303,27 @@ private void downloadAndUnpack(){
|
303 | 303 | }
|
304 | 304 |
|
305 | 305 |
|
| 306 | + //load a list of all files |
| 307 | + int fileCount = 0; |
| 308 | + File dataFolder = new File(editor.getSketch().getFolder(), "data"); |
| 309 | + if (!dataFolder.exists()) { |
| 310 | + dataFolder.mkdirs(); |
| 311 | + } |
| 312 | + |
| 313 | + Object[] options = { "Yes", "No" }; |
| 314 | + String title = "SPIFFS Unpack"; |
| 315 | + String message = "Data directory not empty!\nAre you sure you want to overwrite this directory?"; |
| 316 | + if(dataFolder.exists() && dataFolder.isDirectory()){ |
| 317 | + File[] files = dataFolder.listFiles(); |
| 318 | + if (files.length > 0 && JOptionPane.showOptionDialog(editor, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]) != JOptionPane.YES_OPTION){ |
| 319 | + System.err.println(); |
| 320 | + editor.statusError("SPIFFS Warning: unpack canceled!"); |
| 321 | + return; |
| 322 | + } |
| 323 | + } |
| 324 | + |
| 325 | + String dataPath = dataFolder.getAbsolutePath(); |
| 326 | + |
306 | 327 | editor.statusNotice("SPIFFS Downloading Image...");
|
307 | 328 | System.out.println("[SPIFFS] download : "+imagePath);
|
308 | 329 | System.out.println("[SPIFFS] address: "+spiStart);
|
@@ -334,28 +355,6 @@ private void downloadAndUnpack(){
|
334 | 355 | editor.statusError("SPIFFS Download Failed!");
|
335 | 356 | return;
|
336 | 357 | }
|
337 |
| - |
338 |
| - |
339 |
| - //load a list of all files |
340 |
| - int fileCount = 0; |
341 |
| - File dataFolder = new File(editor.getSketch().getFolder(), "data"); |
342 |
| - if (!dataFolder.exists()) { |
343 |
| - dataFolder.mkdirs(); |
344 |
| - } |
345 |
| - |
346 |
| - Object[] options = { "Yes", "No" }; |
347 |
| - String title = "SPIFFS Unpack"; |
348 |
| - String message = "Data directory not empty!\nAre you sure you want to overwrite this directory?"; |
349 |
| - if(dataFolder.exists() && dataFolder.isDirectory()){ |
350 |
| - File[] files = dataFolder.listFiles(); |
351 |
| - if (files.length > 0 && JOptionPane.showOptionDialog(editor, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]) != JOptionPane.YES_OPTION){ |
352 |
| - System.err.println(); |
353 |
| - editor.statusError("SPIFFS Warning: unpack canceled!"); |
354 |
| - return; |
355 |
| - } |
356 |
| - } |
357 |
| - |
358 |
| - String dataPath = dataFolder.getAbsolutePath(); |
359 | 358 |
|
360 | 359 | editor.statusNotice("SPIFFS Unpacking Image...");
|
361 | 360 | System.out.println("[SPIFFS] data : "+dataPath);
|
|
0 commit comments