backend: simplify condition
This commit is contained in:
parent
7c07cbb010
commit
6fab208a23
1 changed files with 3 additions and 5 deletions
|
@ -109,12 +109,10 @@ func main() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case ev := <-watcher.Events:
|
case ev := <-watcher.Events:
|
||||||
if ev.Op & fsnotify.Create == fsnotify.Create {
|
if d, err := os.Stat(ev.Name); err == nil && d.IsDir() && ev.Op & fsnotify.Create == fsnotify.Create {
|
||||||
// Register new subdirectory
|
// Register new subdirectory
|
||||||
if d, err := os.Stat(ev.Name); err == nil && d.IsDir() {
|
if err := watchsubdir(watcher, ev.Name); err != nil {
|
||||||
if err := watchsubdir(watcher, ev.Name); err != nil {
|
log.Println(err)
|
||||||
log.Println(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if ev.Op & fsnotify.Write == fsnotify.Write {
|
} else if ev.Op & fsnotify.Write == fsnotify.Write {
|
||||||
go treat(ev.Name)
|
go treat(ev.Name)
|
||||||
|
|
Reference in a new issue