Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/ESP8266FS.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import java.io.InputStreamReader;
import java.io.IOException;

import java.nio.file.Files;
import java.nio.file.StandardCopyOption;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.lang.reflect.Field;
Expand Down Expand Up @@ -260,7 +263,7 @@ private void createAndUpload(){
String dataPath = dataFolder.getAbsolutePath();
String toolPath = tool.getAbsolutePath();
String sketchName = editor.getSketch().getName();
String imagePath = getBuildFolderPath(editor.getSketch()) + "/" + sketchName + ".spiffs.bin";
String imagePath = getBuildFolderPath(editor.getSketch()) + "\\" + sketchName + ".spiffs.bin";
String resetMethod = BaseNoGui.getBoardPreferences().get("upload.resetmethod");
String uploadSpeed = BaseNoGui.getBoardPreferences().get("upload.speed");
String uploadAddress = BaseNoGui.getBoardPreferences().get("build.spiffs_start");
Expand Down Expand Up @@ -294,6 +297,21 @@ private void createAndUpload(){
editor.statusError("SPIFFS Create Failed!");
return;
}

title = "SPIFFS Copy";
message = "Would you like a copy of the SPIFFS image in your project folder?";

if(JOptionPane.showOptionDialog(editor, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]) == JOptionPane.YES_OPTION){
File source = new File(imagePath);
File dest = new File(editor.getSketch().getFolder(),"\\" + sketchName + ".spiffs.bin");
try {
Files.copy(source.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
System.out.println("Copied SPIFFS image");
} catch (IOException e) {
System.out.println(e);
editor.statusError("Copy SPIFFS image failed");
}
}

editor.statusNotice("SPIFFS Uploading Image...");
System.out.println("[SPIFFS] upload : "+imagePath);
Expand Down