From 0bd6f01957fad658fbf75b7742dbd33703f504e7 Mon Sep 17 00:00:00 2001 From: PaulStoffregen Date: Mon, 24 Aug 2015 14:13:09 -0700 Subject: [PATCH] Add second output recipe, to save .elf file --- .../src/processing/app/debug/Compiler.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arduino-core/src/processing/app/debug/Compiler.java b/arduino-core/src/processing/app/debug/Compiler.java index c72c5d7..15673df 100644 --- a/arduino-core/src/processing/app/debug/Compiler.java +++ b/arduino-core/src/processing/app/debug/Compiler.java @@ -1266,6 +1266,22 @@ void saveHex() throws RunnerException { } catch (Exception e) { throw new RunnerException(e); } + + if (prefs.containsKey("recipe.output.tmp_file2") && prefs.containsKey("recipe.output.save_file2")) { + try { + String compiledSketch = prefs.getOrExcept("recipe.output.tmp_file2"); + compiledSketch = StringReplacer.replaceFromMapping(compiledSketch, dict); + String copyOfCompiledSketch = prefs.getOrExcept("recipe.output.save_file2"); + copyOfCompiledSketch = StringReplacer.replaceFromMapping(copyOfCompiledSketch, dict); + + File compiledSketchFile = new File(prefs.get("build.path"), compiledSketch); + File copyOfCompiledSketchFile = new File(sketch.getFolder(), copyOfCompiledSketch); + + FileUtils.copyFile(compiledSketchFile, copyOfCompiledSketchFile); + } catch (Exception e) { + throw new RunnerException(e); + } + } }