File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 3030package builder
3131
3232import (
33- "arduino.cc/builder/types"
34- "arduino.cc/builder/utils"
33+ "bufio"
3534 "strconv"
3635 "strings"
36+
37+ "arduino.cc/builder/types"
38+ "arduino.cc/builder/utils"
3739)
3840
3941type FilterSketchSource struct {
40- Source * string
42+ Source * string
4143}
4244
4345func (s * FilterSketchSource ) Run (ctx * types.Context ) error {
44- lines := strings .Split (* s .Source , "\n " )
45-
4646 fileNames := []string {ctx .Sketch .MainFile .Name }
4747 for _ , file := range ctx .Sketch .OtherSketchFiles {
4848 fileNames = append (fileNames , file .Name )
@@ -51,7 +51,9 @@ func (s *FilterSketchSource) Run(ctx *types.Context) error {
5151 inSketch := false
5252 filtered := ""
5353
54- for _ , line := range lines {
54+ scanner := bufio .NewScanner (strings .NewReader (* s .Source ))
55+ for scanner .Scan () {
56+ line := scanner .Text ()
5557 filename := parseLineMarker (line )
5658 if filename != "" {
5759 inSketch = utils .SliceContains (fileNames , filename )
@@ -96,4 +98,3 @@ func parseLineMarker(line string) string {
9698 }
9799 return ""
98100}
99-
You can’t perform that action at this time.
0 commit comments