From 71c81e30a7cdfea93024f82efe8d903a8c458b3a Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Thu, 24 Sep 2015 16:05:41 +0200 Subject: [PATCH] Allow highlighting line with error even if gcc reports full path to file --- arduino-core/src/cc/arduino/Compiler.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/arduino-core/src/cc/arduino/Compiler.java b/arduino-core/src/cc/arduino/Compiler.java index b1c0beb84..41dfc47dd 100644 --- a/arduino-core/src/cc/arduino/Compiler.java +++ b/arduino-core/src/cc/arduino/Compiler.java @@ -536,9 +536,7 @@ public class Compiler implements MessageConsumer { RunnerException exception = placeException(error, pieces[1], PApplet.parseInt(pieces[2]) - 1); - // 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 (exception != null && !verbose) { + if (exception != null) { SketchCode code = sketch.getCode(exception.getCodeIndex()); String fileName = (code.isExtension("ino") || code.isExtension("pde")) ? code.getPrettyName() : code.getFileName(); int lineNum = exception.getCodeLine() + 1; @@ -568,15 +566,10 @@ public class Compiler implements MessageConsumer { System.err.println(s); } - private RunnerException placeException(String message, - String dotJavaFilename, - int dotJavaLine) { - // Placing errors is simple, because we inserted #line directives - // into the preprocessed source. The compiler gives us correct - // the file name and line number. :-) + private RunnerException placeException(String message, String fileName, int line) { for (SketchCode code : sketch.getCodes()) { - if (dotJavaFilename.equals(code.getFileName())) { - return new RunnerException(message, sketch.indexOfCode(code), dotJavaLine); + if (new File(fileName).getName().equals(code.getFileName())) { + return new RunnerException(message, sketch.indexOfCode(code), line); } } return null;