@@ -17,12 +17,12 @@ package builder
17
17
18
18
import (
19
19
"bytes"
20
+ "fmt"
20
21
"io/ioutil"
21
22
"os"
22
23
"path/filepath"
23
24
"regexp"
24
25
"strings"
25
- "fmt"
26
26
27
27
"github.com/arduino/arduino-cli/arduino/globals"
28
28
"github.com/arduino/arduino-cli/arduino/sketch"
@@ -59,8 +59,7 @@ func SketchSaveItemCpp(item *sketch.Item, destPath string) error {
59
59
return nil
60
60
}
61
61
62
- // SimpleLocalWalk locally replaces filepath.Walk and/but goes through symlinks
63
- func SimpleLocalWalkRecursive (root string , maxDepth int , walkFn func (path string , info os.FileInfo , err error ) error ) error {
62
+ func simpleLocalWalkRecursive (root string , maxDepth int , walkFn func (path string , info os.FileInfo , err error ) error ) error {
64
63
65
64
info , err := os .Stat (root )
66
65
@@ -75,13 +74,13 @@ func SimpleLocalWalkRecursive(root string, maxDepth int, walkFn func(path string
75
74
76
75
if info .IsDir () {
77
76
if maxDepth <= 0 {
78
- return walkFn (root , info , errors .New ("Filesystem bottom is too deep (directory recursion or filesystem really deep): " + root ))
77
+ return walkFn (root , info , errors .New ("Filesystem bottom is too deep (directory recursion or filesystem really deep): " + root ))
79
78
}
80
79
maxDepth --
81
80
files , err := ioutil .ReadDir (root )
82
81
if err == nil {
83
82
for _ , file := range files {
84
- err = SimpleLocalWalkRecursive (root + string (os .PathSeparator )+ file .Name (), maxDepth , walkFn )
83
+ err = simpleLocalWalkRecursive (root + string (os .PathSeparator )+ file .Name (), maxDepth , walkFn )
85
84
if err == filepath .SkipDir {
86
85
return nil
87
86
}
@@ -92,9 +91,10 @@ func SimpleLocalWalkRecursive(root string, maxDepth int, walkFn func(path string
92
91
return nil
93
92
}
94
93
94
+ // SimpleLocalWalk locally replaces filepath.Walk and/but goes through symlinks
95
95
func SimpleLocalWalk (root string , walkFn func (path string , info os.FileInfo , err error ) error ) error {
96
96
// see discussion in https://github.com/arduino/arduino-cli/pull/421
97
- return SimpleLocalWalkRecursive (root , 40 , walkFn )
97
+ return simpleLocalWalkRecursive (root , 40 , walkFn )
98
98
}
99
99
100
100
// SketchLoad collects all the files composing a sketch.
@@ -137,7 +137,7 @@ func SketchLoad(sketchPath, buildPath string) (*sketch.Sketch, error) {
137
137
138
138
if err != nil {
139
139
fmt .Printf ("\n error: %+v\n \n " , err )
140
- return filepath .SkipDir ;
140
+ return filepath .SkipDir
141
141
}
142
142
143
143
// ignore hidden files and skip hidden directories
0 commit comments