@@ -840,7 +840,7 @@ private String build(String buildPath, boolean verbose, boolean save) throws Run
840
840
CompilerProgressListener progressListener = editor .status ::progressUpdate ;
841
841
842
842
boolean deleteTemp = false ;
843
- String pathToSketch = sketch .getMainFilePath ();
843
+ File pathToSketch = sketch .getPrimaryFile (). getFile ();
844
844
if (sketch .isModified ()) {
845
845
// If any files are modified, make a copy of the sketch with the changes
846
846
// saved, so arduino-builder will see the modifications.
@@ -853,19 +853,19 @@ private String build(String buildPath, boolean verbose, boolean save) throws Run
853
853
} finally {
854
854
// Make sure we clean up any temporary sketch copy
855
855
if (deleteTemp )
856
- FileUtils .recursiveDelete (new File ( pathToSketch ) .getParentFile ());
856
+ FileUtils .recursiveDelete (pathToSketch .getParentFile ());
857
857
}
858
858
}
859
859
860
- private String saveSketchInTempFolder () throws IOException {
860
+ private File saveSketchInTempFolder () throws IOException {
861
861
File tempFolder = FileUtils .createTempFolder ("arduino_modified_sketch_" );
862
862
FileUtils .copy (sketch .getFolder (), tempFolder );
863
863
864
864
for (SketchFile file : Stream .of (sketch .getFiles ()).filter (SketchFile ::isModified ).collect (Collectors .toList ())) {
865
865
Files .write (Paths .get (tempFolder .getAbsolutePath (), file .getFileName ()), file .getProgram ().getBytes ());
866
866
}
867
867
868
- return Paths .get (tempFolder .getAbsolutePath (), sketch .getPrimaryFile ().getFileName ()).toString ();
868
+ return Paths .get (tempFolder .getAbsolutePath (), sketch .getPrimaryFile ().getFileName ()).toFile ();
869
869
}
870
870
871
871
protected boolean exportApplet (boolean usingProgrammer ) throws Exception {
0 commit comments