Skip to content

Commit 33027e4

Browse files
facchinmcmaglie
authored andcommitted
[WIN] make filepath relative to overcome parsing difficulties
Fixing https://github.com/arduino/arduino-preprocessor/blob/master/CommandLine.cpp#L91 should have the same effect but let's try with this first
1 parent 3f70085 commit 33027e4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: preprocess_sketch.go

+12
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ package builder
3232
import (
3333
"fmt"
3434
"path/filepath"
35+
"runtime"
36+
"strings"
3537

3638
"github.com/arduino/arduino-builder/constants"
3739
"github.com/arduino/arduino-builder/i18n"
@@ -77,6 +79,16 @@ func (s *ArduinoPreprocessorRunner) Run(ctx *types.Context) error {
7779
properties.Merge(toolProps)
7880
properties[constants.BUILD_PROPERTIES_SOURCE_FILE] = targetFilePath
7981
if ctx.CodeCompleteAt != "" {
82+
if runtime.GOOS == "windows" {
83+
//use relative filepath to avoid ":" escaping
84+
splt := strings.Split(ctx.CodeCompleteAt, ":")
85+
if len(splt) == 3 {
86+
//all right, do nothing
87+
} else {
88+
splt[1] = filepath.Base(splt[0] + ":" + splt[1])
89+
ctx.CodeCompleteAt = strings.Join(splt[1:], ":")
90+
}
91+
}
8092
properties["codecomplete"] = "-output-code-completions=" + ctx.CodeCompleteAt
8193
} else {
8294
properties["codecomplete"] = ""

0 commit comments

Comments
 (0)