Fix watcher scan skipping a whole directory on ignored files

This commit is contained in:
Max Claus Nunes 2018-06-24 20:49:28 -03:00
parent a553e8038e
commit eb4510b3fe
1 changed files with 10 additions and 3 deletions

View File

@ -88,12 +88,12 @@ func (w *Watcher) scanChange(watchPath string) (string, error) {
err := filepath.Walk(watchPath, func(path string, info os.FileInfo, err error) error {
// always ignore hidden files and directories
if filepath.Base(path)[0] == '.' {
return nil
if dir := filepath.Base(path); dir[0] == '.' && dir != "." {
return skipFile(info)
}
if _, ignored := w.IgnoreItems[path]; ignored {
return filepath.SkipDir
return skipFile(info)
}
ext := filepath.Ext(path)
@ -175,3 +175,10 @@ func removeOverlappedPaths(mapPaths map[string]bool) {
}
}
}
func skipFile(info os.FileInfo) error {
if info.IsDir() {
return filepath.SkipDir
}
return nil
}