Merge pull request #98 from tockins/dev

file event fixed for temp file
This commit is contained in:
Alessio Pracchia 2017-10-19 00:54:18 +02:00 committed by GitHub
commit 01f52c34cb
1 changed files with 3 additions and 5 deletions

View File

@ -122,7 +122,7 @@ L:
case fsnotify.Chmod: case fsnotify.Chmod:
case fsnotify.Remove: case fsnotify.Remove:
ext := ext(event.Name) ext := ext(event.Name)
if !strings.Contains(ext, "_") && ext != "" { if !strings.Contains(ext, "_") && !strings.Contains(ext, ".") && array(ext, p.Watcher.Exts) {
close(stop) close(stop)
stop = make(chan bool) stop = make(chan bool)
p.changed(event, stop) // stop p.changed(event, stop) // stop
@ -134,15 +134,13 @@ L:
continue continue
} }
if file.IsDir() { 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 { } else if file.Size() > 0 {
if p.parent.Settings.Recovery { if p.parent.Settings.Recovery {
log.Println(event) log.Println(event)
} }
ext := ext(event.Name) 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 // change watched
close(stop) close(stop)
stop = make(chan bool) stop = make(chan bool)