for _, fileInfo := range files {
filePath := filepath.Join(dirPath, fileInfo.Name())
if fileInfo.IsDir() == false {
- // Watch file to mimic linux fsnotify
- e := w.addWatch(filePath, NOTE_DELETE|NOTE_WRITE|NOTE_RENAME)
+ // Inherit fsnFlags from parent directory
w.fsnmut.Lock()
- w.fsnFlags[filePath] = FSN_ALL
+ dirFsnFlags, dirFsnFound := w.fsnFlags[dirPath]
+ if dirFsnFound {
+ w.fsnFlags[filePath] = dirFsnFlags
+ } else {
+ w.fsnFlags[filePath] = FSN_ALL
+ }
w.fsnmut.Unlock()
+
+ // Watch file to mimic linux fsnotify
+ e := w.addWatch(filePath, NOTE_DELETE|NOTE_WRITE|NOTE_RENAME)
if e != nil {
return e
}