base commit
This commit is contained in:
parent
4d7acdc014
commit
5d40de4bf3
3 changed files with 125 additions and 0 deletions
19
watch.go
Normal file
19
watch.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
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()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue