My code is a toy program for the recursive watcher.
func (watcher *RecursiveWatcher) StartWatching() error {
if err := notify.Watch(watcher.directory + "/...", watcher.watchChannel, notify.All); err != nil {
return err
}
watcher.ctx, watcher.cancel = context.WithCancel(context.Background())
watcher.watch()
return nil
}
func (watcher *RecursiveWatcher) watch() {
go func() {
for {
select {
case notifyEvent:= <-watcher.watchChannel:
log.Println("Got new event", notifyEvent.Event().String(), notifyEvent.Path(), notifyEvent.Sys())
case <-watcher.ctx.Done():
log.Println("watch(): closing watcher")
return
}
}
}()
}
The directory is a shared network folder e.g. "//COMPUTER/test_share/...", and is accessible by the program. I get events if they're made in the directory "test_share", but if there are any events in the subdirectories, I get no notifications.
My code is a toy program for the recursive watcher.
The directory is a shared network folder e.g. "//COMPUTER/test_share/...", and is accessible by the program. I get events if they're made in the directory "test_share", but if there are any events in the subdirectories, I get no notifications.