From c3a6ae592232d49bd517a6b9ae405cca172ed1b0 Mon Sep 17 00:00:00 2001 From: asoseil Date: Thu, 16 Nov 2017 07:55:39 +0100 Subject: [PATCH] #128 fixed --- watcher.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/watcher.go b/watcher.go index a53ba20..484b9f3 100644 --- a/watcher.go +++ b/watcher.go @@ -97,7 +97,7 @@ func (p *Project) watch() { p.cmd(stop, "before", true) // indexing files and dirs for _, dir := range p.Watcher.Paths { - base := filepath.Join(p.Path, dir) + base := filepath.Join(wdir(), dir) if _, err := os.Stat(base); err == nil { if err := filepath.Walk(base, p.walk); err == nil { p.tool(stop, base) @@ -154,7 +154,7 @@ L: if !strings.Contains(ext, "_") && !strings.Contains(ext, ".") && array(ext, p.Watcher.Exts) { // change watched // check if a file is still writing #119 - if event.Op != fsnotify.Write || eventTime.Truncate(time.Millisecond).After(file.ModTime().Truncate(time.Millisecond)) { + if event.Op != fsnotify.Write || (eventTime.Truncate(time.Millisecond).After(file.ModTime().Truncate(time.Millisecond)) || event.Name != p.lastFile) { close(stop) stop = make(chan bool) // stop and start again @@ -528,5 +528,4 @@ func (p *Project) routines(stop <-chan bool, watcher FileWatcher, path string) { return } p.cmd(stop, "after", false) - }