hoboken/watch.go
2016-10-31 15:10:02 -07:00

19 lines
286 B
Go

package hoboken
import (
"log"
"github.com/rjeczalik/notify"
)
func WatchDir(path string, p *Projects) {
c := make(chan notify.EventInfo, 1)
if err := notify.Watch(path, c, notify.All); err != nil {
log.Fatal(err)
}
defer notify.Stop(c)
for _ = range c {
p.Reload()
}
}