fixed file counter

This commit is contained in:
alessio 2016-08-23 13:06:39 +02:00
parent 135b1b51b9
commit e2a637065d
1 changed files with 5 additions and 3 deletions

View File

@ -84,7 +84,9 @@ func (p *Project) watching() {
if err = watcher.Add(path); err != nil { if err = watcher.Add(path); err != nil {
return filepath.SkipDir return filepath.SkipDir
} }
counter++ if inArray(filepath.Ext(path), p.Watcher.Exts) {
counter++
}
} }
} }
return nil return nil
@ -112,7 +114,7 @@ func (p *Project) watching() {
} }
} }
fmt.Println(Red("Watching: "), pname(p.Name, 1), Magenta(counter), "files") fmt.Println(Red("Watching: "), pname(p.Name, 1), Magenta(counter), "files \n")
go routines(p, channel, &wr) go routines(p, channel, &wr)
p.reload = time.Now().Truncate(time.Second) p.reload = time.Now().Truncate(time.Second)
@ -126,7 +128,7 @@ func (p *Project) watching() {
if _, err := os.Stat(event.Name); err == nil { if _, err := os.Stat(event.Name); err == nil {
i := strings.Index(event.Name, filepath.Ext(event.Name)) i := strings.Index(event.Name, filepath.Ext(event.Name))
if event.Name[:i] != "" { if event.Name[:i] != "" {
log.Println(pname(p.Name, 4), ":", Magenta(event.Name[:i])) log.Println(pname(p.Name, 4), ":", Magenta(event.Name))
// stop and run again // stop and run again
if p.Run { if p.Run {