backend: simplify condition

This commit is contained in:
nemunaire 2017-04-05 02:02:10 +02:00
parent 7c07cbb010
commit 6fab208a23
1 changed files with 3 additions and 5 deletions

View File

@ -109,12 +109,10 @@ func main() {
for {
select {
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
if d, err := os.Stat(ev.Name); err == nil && d.IsDir() {
if err := watchsubdir(watcher, ev.Name); err != nil {
log.Println(err)
}
if err := watchsubdir(watcher, ev.Name); err != nil {
log.Println(err)
}
} else if ev.Op & fsnotify.Write == fsnotify.Write {
go treat(ev.Name)