func (s *SpecInfoGatherer) handleEvent(event fsnotify.Event, watcher *fsnotify.Watcher) { s.waitGroup.Wait() file, err := filepath.Abs(event.Name) if err != nil { logger.APILog.Error("Failed to get abs file path for %s: %s", event.Name, err) return } if util.IsSpec(file) || util.IsConcept(file) || util.IsDir(file) { switch event.Op { case fsnotify.Create: s.onFileAdd(watcher, file) case fsnotify.Write: s.onFileModify(watcher, file) case fsnotify.Rename: s.onFileRename(watcher, file) case fsnotify.Remove: s.onFileRemove(watcher, file) } } }
func (s *SpecInfoGatherer) onFileAdd(watcher *fsnotify.Watcher, file string) { if util.IsDir(file) { s.addDirToFileWatcher(watcher, file) } s.onFileModify(watcher, file) }
func (specInfoGatherer *SpecInfoGatherer) fileAdded(watcher *fsnotify.Watcher, fileName string) { if util.IsDir(fileName) { specInfoGatherer.addDirToFileWatcher(watcher, fileName) } specInfoGatherer.fileModified(watcher, fileName) }