mirror of https://github.com/noisymime/Arduino.git
Using FileUtils.copyFile instead of dealing with raw streams
This commit is contained in:
parent
166c1aa7bb
commit
90a533b82c
|
@ -1158,7 +1158,6 @@ public class Compiler implements MessageConsumer {
|
||||||
PreferencesMap dict = new PreferencesMap(prefs);
|
PreferencesMap dict = new PreferencesMap(prefs);
|
||||||
dict.put("ide_version", "" + BaseNoGui.REVISION);
|
dict.put("ide_version", "" + BaseNoGui.REVISION);
|
||||||
|
|
||||||
String[] cmdArray;
|
|
||||||
try {
|
try {
|
||||||
String tmp_file = prefs.getOrExcept("recipe.output.tmp_file");
|
String tmp_file = prefs.getOrExcept("recipe.output.tmp_file");
|
||||||
tmp_file = StringReplacer.replaceFromMapping(tmp_file, dict);
|
tmp_file = StringReplacer.replaceFromMapping(tmp_file, dict);
|
||||||
|
@ -1168,16 +1167,7 @@ public class Compiler implements MessageConsumer {
|
||||||
File hexFile = new File(prefs.get("build.path") + "/" + tmp_file);
|
File hexFile = new File(prefs.get("build.path") + "/" + tmp_file);
|
||||||
File saveFile = new File(sketch.getFolder().getAbsolutePath() + "/" + save_file);
|
File saveFile = new File(sketch.getFolder().getAbsolutePath() + "/" + save_file);
|
||||||
|
|
||||||
FileReader in = new FileReader(hexFile);
|
FileUtils.copyFile(hexFile, saveFile);
|
||||||
FileWriter out = new FileWriter(saveFile);
|
|
||||||
|
|
||||||
int c;
|
|
||||||
while ((c = in.read()) != -1)
|
|
||||||
out.write(c);
|
|
||||||
|
|
||||||
in.close();
|
|
||||||
out.close();
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RunnerException(e);
|
throw new RunnerException(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue