@@ -58,6 +58,33 @@ func SketchSaveItemCpp(item *sketch.Item, destPath string) error {
58
58
return nil
59
59
}
60
60
61
+ func SimpleLocalWalk (root string , walkFn func (path string , info os.FileInfo , err error ) error ) error {
62
+ info , err := os .Stat (root )
63
+
64
+ if err != nil {
65
+ return walkFn (root , nil , err )
66
+ }
67
+
68
+ err = walkFn (root , info , err )
69
+ if err == filepath .SkipDir {
70
+ return nil
71
+ }
72
+
73
+ if info .IsDir () {
74
+ files , err := ioutil .ReadDir (root )
75
+ if err == nil {
76
+ for _ , file := range files {
77
+ err = SimpleLocalWalk (root + string (os .PathSeparator ) + file .Name (), walkFn )
78
+ if err == filepath .SkipDir {
79
+ return nil
80
+ }
81
+ }
82
+ }
83
+ }
84
+
85
+ return nil
86
+ }
87
+
61
88
// SketchLoad collects all the files composing a sketch.
62
89
// The parameter `sketchPath` holds a path pointing to a single sketch file or a sketch folder,
63
90
// the path must be absolute.
@@ -86,7 +113,8 @@ func SketchLoad(sketchPath, buildPath string) (*sketch.Sketch, error) {
86
113
87
114
// collect all the sketch files
88
115
var files []string
89
- err = filepath .Walk (sketchFolder , func (path string , info os.FileInfo , err error ) error {
116
+ err = SimpleLocalWalk (sketchFolder , func (path string , info os.FileInfo , err error ) error {
117
+
90
118
// ignore hidden files and skip hidden directories
91
119
if strings .HasPrefix (info .Name (), "." ) {
92
120
if info .IsDir () {
0 commit comments