From 87ed5f35ec3d2030e03ede8bb413e3eba774448f 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, to improve 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 b540d9d943a..1df6c1bc47f 100644 --- a/arduino/builder/sketch.go +++ b/arduino/builder/sketch.go @@ -281,6 +281,9 @@ func writeIfDifferent(sourcePath, destPath string) error { return errors.Wrap(err, "unable to read contents of the source item") } + // tag each addtional file with the filename of the source it was copied from + newbytes = []byte("#line 1 " + QuoteCppString(sourcePath) + "\n" + string(newbytes)) + // check whether the destination file exists _, err = os.Stat(destPath) if os.IsNotExist(err) {