Skip to content

Commit 71c81e3

Browse files
author
Federico Fissore
committed
Allow highlighting line with error even if gcc reports full path to file
1 parent 563a730 commit 71c81e3

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

arduino-core/src/cc/arduino/Compiler.java

+4-11
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,7 @@ public void message(String s) {
536536

537537
RunnerException exception = placeException(error, pieces[1], PApplet.parseInt(pieces[2]) - 1);
538538

539-
// replace full file path with the name of the sketch tab (unless we're
540-
// in verbose mode, in which case don't modify the compiler output)
541-
if (exception != null && !verbose) {
539+
if (exception != null) {
542540
SketchCode code = sketch.getCode(exception.getCodeIndex());
543541
String fileName = (code.isExtension("ino") || code.isExtension("pde")) ? code.getPrettyName() : code.getFileName();
544542
int lineNum = exception.getCodeLine() + 1;
@@ -568,15 +566,10 @@ public void message(String s) {
568566
System.err.println(s);
569567
}
570568

571-
private RunnerException placeException(String message,
572-
String dotJavaFilename,
573-
int dotJavaLine) {
574-
// Placing errors is simple, because we inserted #line directives
575-
// into the preprocessed source. The compiler gives us correct
576-
// the file name and line number. :-)
569+
private RunnerException placeException(String message, String fileName, int line) {
577570
for (SketchCode code : sketch.getCodes()) {
578-
if (dotJavaFilename.equals(code.getFileName())) {
579-
return new RunnerException(message, sketch.indexOfCode(code), dotJavaLine);
571+
if (new File(fileName).getName().equals(code.getFileName())) {
572+
return new RunnerException(message, sketch.indexOfCode(code), line);
580573
}
581574
}
582575
return null;

0 commit comments

Comments
 (0)