validate method fixed
This commit is contained in:
parent
930f2a3562
commit
c58c002c7e
|
@ -294,7 +294,7 @@ L:
|
||||||
case fsnotify.Chmod:
|
case fsnotify.Chmod:
|
||||||
case fsnotify.Remove:
|
case fsnotify.Remove:
|
||||||
p.watcher.Remove(event.Name)
|
p.watcher.Remove(event.Name)
|
||||||
if p.Validate(event.Name, false) {
|
if p.Validate(event.Name, false) && ext(event.Name) != "" {
|
||||||
// stop and restart
|
// stop and restart
|
||||||
close(p.stop)
|
close(p.stop)
|
||||||
p.stop = make(chan bool)
|
p.stop = make(chan bool)
|
||||||
|
@ -320,7 +320,6 @@ L:
|
||||||
p.lastTime = time.Now().Truncate(time.Second)
|
p.lastTime = time.Now().Truncate(time.Second)
|
||||||
p.lastFile = event.Name
|
p.lastFile = event.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,10 +348,6 @@ func (p *Project) Validate(path string, fcheck bool) bool {
|
||||||
if !array(e, p.Watcher.Exts) {
|
if !array(e, p.Watcher.Exts) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
if !array(filepath.Base(path), p.Watcher.Paths) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
separator := string(os.PathSeparator)
|
separator := string(os.PathSeparator)
|
||||||
// supported paths
|
// supported paths
|
||||||
|
|
|
@ -130,7 +130,7 @@ func TestProject_Validate(t *testing.T) {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
for i, v := range data {
|
for i, v := range data {
|
||||||
if r.Projects[0].Validate(i, true) != v {
|
if r.Projects[0].Validate(i, false) != v {
|
||||||
t.Error("Unexpected error", i, "expected", v)
|
t.Error("Unexpected error", i, "expected", v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue