func handleChange(event fsnotify.Event, db *SymbolsDB, watcher *fsnotify.Watcher, files chan string) { visitorDir := func(path string) { // add watcher to directory watcher.Add(path) } visitorC := func(path string) { // add watcher watcher.Add(path) // put file in channel files <- path } switch { case event.Op&(fsnotify.Write|fsnotify.Create|fsnotify.Chmod) != 0: traversePath(event.Name, visitorDir, visitorC) case event.Op&(fsnotify.Remove|fsnotify.Rename) != 0: watcher.Remove(event.Name) tx := db.BeginTx() tx.RemoveFileReferences(filepath.Clean(event.Name)) tx.Close() } }
func (s *SpecInfoGatherer) removeWatcherOn(watcher *fsnotify.Watcher, path string) { logger.APILog.Info("Removing watcher on : %s", path) watcher.Remove(path) }
func (specInfoGatherer *specInfoGatherer) removeWatcherOn(watcher *fsnotify.Watcher, path string) { logger.ApiLog.Error("Removing watcher on : %s", path) watcher.Remove(path) }