func (s *SpecInfoGatherer) onFileModify(watcher *fsnotify.Watcher, file string) { if util.IsSpec(file) { s.onSpecFileModify(file) } else if util.IsConcept(file) { s.onConceptFileModify(file) } }
func (specInfoGatherer *SpecInfoGatherer) fileModified(watcher *fsnotify.Watcher, fileName string) { if util.IsSpec(fileName) { specInfoGatherer.addSpec(fileName) } else if util.IsConcept(fileName) { specInfoGatherer.addConcept(fileName) } }
func (s *SpecInfoGatherer) onFileRemove(watcher *fsnotify.Watcher, file string) { if util.IsSpec(file) { s.onSpecFileRemove(file) } else if util.IsConcept(file) { s.onConceptFileRemove(file) } else { s.removeWatcherOn(watcher, file) } }
func (specInfoGatherer *SpecInfoGatherer) fileRemoved(watcher *fsnotify.Watcher, fileName string) { if util.IsSpec(fileName) { specInfoGatherer.removeSpec(fileName) } else if util.IsConcept(fileName) { specInfoGatherer.removeConcept(fileName) } else { specInfoGatherer.removeWatcherOn(watcher, fileName) } }
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) { 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) } } }