func adjustWatchSet(watcher *fsnotify.Watcher, event fsnotify.Event, sandbox Path) {
	// Update our watcher to watch new directories and ignore deleted directories
	if event.Op&fsnotify.Create == fsnotify.Create || event.Op&fsnotify.Remove == fsnotify.Remove {

		// There's a bunch of files starting with .jazz in our sandbox root that
		// look like metadata and temp directories. Don't subscribe to their events.
		eventPath := pathToArray(event.Name)
		if sandbox.isPrefixOf(eventPath) {
			if len(eventPath) > len(sandbox) && strings.HasPrefix(eventPath[len(sandbox)], ".jazz") {
				fmt.Println("Skipping event \"", event.Name, "\" due to .jazz prefix")
				return
			}
		}

		// If we create a new directory, we need to track its contents as well
		stat, err := os.Lstat(event.Name)
		if err != nil {
			fmt.Println("Failed to stat: ", event.Name)
			return
		}

		if stat.IsDir() {
			if event.Op&fsnotify.Remove == fsnotify.Remove {
				fmt.Println("Incremental directory remove ", event.Name)
				watcher.Remove(event.Name)
			} else if event.Op&fsnotify.Create == fsnotify.Create {
				fmt.Println("Incremental directory add ", event.Name)
				watcher.Add(event.Name)
			}
		}
	}
}
// Updates our Watcher with newly created directories.
Updates our Watcher with newly created directories.
// Updates our Watcher with newly created directories .
func adjustWatchSet(watcher *fsnotify.Watcher, event fsnotify.Event, sandbox Path) {
	if event.Op&fsnotify.Create == fsnotify.Create || event.Op&fsnotify.Remove == fsnotify.Remove {
		eventPath := pathToArray(event.Name)
		if sandbox.isPrefixOf(eventPath) {
			if len(eventPath) > len(sandbox) && strings.HasPrefix(eventPath[len(sandbox)], ".jazz") {
				fmt.Println("Skipping event \"", event.Name, "\" due to .jazz prefix")
				return
			}
		}
		stat, err := os.Lstat(event.Name)
		if err != nil {
			fmt.Println("Failed to stat: ", event.Name)
			return
		}
		if stat.IsDir() {
			if event.Op&fsnotify.Remove == fsnotify.Remove {
				fmt.Println("Incremental directory remove ", event.Name)
				watcher.Remove(event.Name)
			} else if event.Op&fsnotify.Create == fsnotify.Create {
				fmt.Println("Incremental directory add ", event.Name)
				watcher.Add(event.Name)
			}
		}
	}
}
func adjustWatchSet ( watcher * fsnotify . Watcher , event fsnotify . Event , sandbox Path ) { if event . Op & fsnotify . Create == fsnotify . Create || event . Op & fsnotify . Remove == fsnotify . Remove { eventPath := pathToArray ( event . Name ) if sandbox . isPrefixOf ( eventPath ) { if len ( eventPath ) > len ( sandbox ) && strings . HasPrefix ( eventPath [ len ( sandbox ) ] , " " ) { fmt . Println ( " \" " , event . Name , " \" " ) return } } stat , err := os . Lstat ( event . Name ) if err != nil { fmt . Println ( " " , event . Name ) return } if stat . IsDir ( ) { if event . Op & fsnotify . Remove == fsnotify . Remove { fmt . Println ( " " , event . Name ) watcher . Remove ( event . Name ) } else if event . Op & fsnotify . Create == fsnotify . Create { fmt . Println ( " " , event . Name ) watcher . Add ( event . Name ) } } } }
Updates our Watcher with newly created directories.
Updates our Watcher with newly created directories .
// Update our watcher to watch new directories and ignore deleted directories // There's a bunch of files starting with .jazz in our sandbox root that // look like metadata and temp directories. Don't subscribe to their events. // If we create a new directory, we need to track its contents as well