From e3856766c6a3a315617ed38374b97a2e44afd27d Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Sat, 28 Aug 2010 09:33:37 +0000 Subject: [PATCH] Creating a custom error message for missing SPI.h (because we changed the Ethernet library to rely on it). issue #337 --- app/src/processing/app/debug/Compiler.java | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index 8777f1d59..c4e12635f 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -354,16 +354,25 @@ public class Compiler implements MessageConsumer { if (pieces != null) { RunnerException e = sketch.placeException(pieces[3], pieces[1], PApplet.parseInt(pieces[2]) - 1); - - if (e != null) { + + // replace full file path with the name of the sketch tab (unless we're + // in verbose mode, in which case don't modify the compiler output) + if (e != null && !verbose) { SketchCode code = sketch.getCode(e.getCodeIndex()); String fileName = code.isExtension(sketch.getDefaultExtension()) ? code.getPrettyName() : code.getFileName(); - if (!verbose) s = fileName + ":" + e.getCodeLine() + ": error: " + e.getMessage(); - if (exception == null) { - exception = e; - exception.hideStackTrace(); - } + s = fileName + ":" + e.getCodeLine() + ": error: " + e.getMessage(); } + + if (pieces[3].trim().equals("SPI.h: No such file or directory")) { + e = new RunnerException("Import the SPI library from the Sketch menu."); + s += "\nAs of Arduino 0019, the Ethernet library depends on the SPI library." + + "\nPlease import it from the Sketch > Import Library menu."; + } + + if (exception == null && e != null) { + exception = e; + exception.hideStackTrace(); + } } System.err.print(s);