check if watcher path exist
This commit is contained in:
parent
d419277505
commit
701644b0ed
|
@ -72,8 +72,17 @@ func (p *Project) Watching(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := filepath.Walk(path + base.String() + dir, walk); err != nil {
|
// add slash if doesn't exist
|
||||||
fmt.Println(err)
|
if string(dir[0]) != "/"{
|
||||||
|
dir = "/"+dir
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(path + base.String() + dir); err == nil {
|
||||||
|
if err := filepath.Walk(path + base.String() + dir, walk); err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
fmt.Println(red(p.Name + ": \t"+path + base.String() + dir +" doesn't exist"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,12 +96,9 @@ func (p *Project) Watching(){
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
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))
|
||||||
log.Println(green(p.Name+":")+"\t", event.Name[:i])
|
log.Println(green(p.Name+":")+"\t", event.Name[:i])
|
||||||
|
|
||||||
// run, bin, build
|
// run, bin, build
|
||||||
|
|
||||||
p.reload = time.Now().Truncate(time.Second)
|
p.reload = time.Now().Truncate(time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue