Skip to content

Commit 90a533b

Browse files
author
Federico Fissore
committed
Using FileUtils.copyFile instead of dealing with raw streams
1 parent 166c1aa commit 90a533b

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

arduino-core/src/processing/app/debug/Compiler.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,6 @@ void saveHex() throws RunnerException {
11581158
PreferencesMap dict = new PreferencesMap(prefs);
11591159
dict.put("ide_version", "" + BaseNoGui.REVISION);
11601160

1161-
String[] cmdArray;
11621161
try {
11631162
String tmp_file = prefs.getOrExcept("recipe.output.tmp_file");
11641163
tmp_file = StringReplacer.replaceFromMapping(tmp_file, dict);
@@ -1168,16 +1167,7 @@ void saveHex() throws RunnerException {
11681167
File hexFile = new File(prefs.get("build.path") + "/" + tmp_file);
11691168
File saveFile = new File(sketch.getFolder().getAbsolutePath() + "/" + save_file);
11701169

1171-
FileReader in = new FileReader(hexFile);
1172-
FileWriter out = new FileWriter(saveFile);
1173-
1174-
int c;
1175-
while ((c = in.read()) != -1)
1176-
out.write(c);
1177-
1178-
in.close();
1179-
out.close();
1180-
1170+
FileUtils.copyFile(hexFile, saveFile);
11811171
} catch (Exception e) {
11821172
throw new RunnerException(e);
11831173
}

0 commit comments

Comments
 (0)