From ce647f2268df04c075e2c94ce00fadf9315d672c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20Sch=C3=B6nrock?= Date: Thu, 14 May 2020 16:11:13 +0100 Subject: [PATCH] Add #line tags to AdditionalFiles when copying to build directory Improves error messages --- arduino/builder/sketch.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arduino/builder/sketch.go b/arduino/builder/sketch.go index 3c20f003609..791d7f0e28b 100644 --- a/arduino/builder/sketch.go +++ b/arduino/builder/sketch.go @@ -289,6 +289,9 @@ func SketchCopyAdditionalFiles(sketch *sketch.Sketch, destPath string, overrides sourceBytes = s } + // tag each addtional file with the filename of the source it was copied from + sourceBytes = append([]byte("#line 1 "+QuoteCppString(item.Path)+"\n"), sourceBytes...) + err = writeIfDifferent(sourceBytes, targetPath) if err != nil { return errors.Wrap(err, "unable to write to destination file")