From e33b41c5d95fc3c86812748b97477caf58fef452 Mon Sep 17 00:00:00 2001 From: asoseil Date: Thu, 19 Oct 2017 00:53:23 +0200 Subject: [PATCH] file event fixed for temp file --- watcher.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/watcher.go b/watcher.go index 571368e..d5b250f 100644 --- a/watcher.go +++ b/watcher.go @@ -122,7 +122,7 @@ L: case fsnotify.Chmod: case fsnotify.Remove: ext := ext(event.Name) - if !strings.Contains(ext, "_") && ext != "" { + if !strings.Contains(ext, "_") && !strings.Contains(ext, ".") && array(ext, p.Watcher.Exts) { close(stop) stop = make(chan bool) p.changed(event, stop) // stop @@ -134,15 +134,13 @@ L: continue } if file.IsDir() { - if time.Now().Truncate(time.Second).After(p.lastTime) { - filepath.Walk(event.Name, p.walk) - } + filepath.Walk(event.Name, p.walk) } else if file.Size() > 0 { if p.parent.Settings.Recovery { log.Println(event) } ext := ext(event.Name) - if (!strings.Contains(ext, "_") || !strings.Contains(ext, ".")) && array(ext, p.Watcher.Exts) { + if !strings.Contains(ext, "_") && !strings.Contains(ext, ".") && array(ext, p.Watcher.Exts) { // change watched close(stop) stop = make(chan bool)