Fix watcher scan skipping a whole directory on ignored files · maxcnunes/gaper@eb4510b

Original file line numberDiff line numberDiff line change

@@ -88,12 +88,12 @@ func (w *Watcher) scanChange(watchPath string) (string, error) {

8888
8989

err := filepath.Walk(watchPath, func(path string, info os.FileInfo, err error) error {

9090

// always ignore hidden files and directories

91-

if filepath.Base(path)[0] == '.' {

92-

return nil

91+

if dir := filepath.Base(path); dir[0] == '.' && dir != "." {

92+

return skipFile(info)

9393

}

9494
9595

if _, ignored := w.IgnoreItems[path]; ignored {

96-

return filepath.SkipDir

96+

return skipFile(info)

9797

}

9898
9999

ext := filepath.Ext(path)

@@ -175,3 +175,10 @@ func removeOverlappedPaths(mapPaths map[string]bool) {

175175

}

176176

}

177177

}

178+
179+

func skipFile(info os.FileInfo) error {

180+

if info.IsDir() {

181+

return filepath.SkipDir

182+

}

183+

return nil

184+

}