From 90a533b82c688c06f68269ca9344f291c372ae06 Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Wed, 13 May 2015 10:16:09 +0200 Subject: [PATCH] Using FileUtils.copyFile instead of dealing with raw streams --- arduino-core/src/processing/app/debug/Compiler.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/arduino-core/src/processing/app/debug/Compiler.java b/arduino-core/src/processing/app/debug/Compiler.java index 8044ea63c..313a6ed57 100644 --- a/arduino-core/src/processing/app/debug/Compiler.java +++ b/arduino-core/src/processing/app/debug/Compiler.java @@ -1158,7 +1158,6 @@ public class Compiler implements MessageConsumer { PreferencesMap dict = new PreferencesMap(prefs); dict.put("ide_version", "" + BaseNoGui.REVISION); - String[] cmdArray; try { String tmp_file = prefs.getOrExcept("recipe.output.tmp_file"); 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 saveFile = new File(sketch.getFolder().getAbsolutePath() + "/" + save_file); - FileReader in = new FileReader(hexFile); - FileWriter out = new FileWriter(saveFile); - - int c; - while ((c = in.read()) != -1) - out.write(c); - - in.close(); - out.close(); - + FileUtils.copyFile(hexFile, saveFile); } catch (Exception e) { throw new RunnerException(e); }