From 87c87c28971c4bf463697fe99f6130735f1cdcbe Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 10 Apr 2014 14:53:05 +0200 Subject: [PATCH] Delete core.a when building it fails This prevents a half-finished core.a file from lingering around. Currently, this should not make a difference since core.a is rebuilt every time, but this prepares for skipping this build step if possible. --- app/src/processing/app/debug/Compiler.java | 29 +++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 29575b08f..ba144a7ba 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -711,21 +711,26 @@ public class Compiler implements MessageConsumer { // Delete the .a file, to prevent any previous code from lingering afile.delete(); - for (File file : coreObjectFiles) { + try { + for (File file : coreObjectFiles) { - PreferencesMap dict = new PreferencesMap(prefs); - dict.put("ide_version", "" + Base.REVISION); - dict.put("archive_file", afile.getName()); - dict.put("object_file", file.getAbsolutePath()); + PreferencesMap dict = new PreferencesMap(prefs); + dict.put("ide_version", "" + Base.REVISION); + dict.put("archive_file", afile.getName()); + dict.put("object_file", file.getAbsolutePath()); - String[] cmdArray; - try { - String cmd = prefs.get("recipe.ar.pattern"); - cmdArray = StringReplacer.formatAndSplit(cmd, dict, true); - } catch (Exception e) { - throw new RunnerException(e); + String[] cmdArray; + try { + String cmd = prefs.get("recipe.ar.pattern"); + cmdArray = StringReplacer.formatAndSplit(cmd, dict, true); + } catch (Exception e) { + throw new RunnerException(e); + } + execAsynchronously(cmdArray); } - execAsynchronously(cmdArray); + } catch (RunnerException e) { + afile.delete(); + throw e; } if (variantFolder != null)