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