check project main

This commit is contained in:
alessio 2016-08-05 00:58:00 +02:00
parent a51e1f9a8f
commit 4baec825cf
1 changed files with 11 additions and 4 deletions

View File

@ -42,6 +42,10 @@ func (p *Project) Watching(){
var watcher *fsnotify.Watcher
channel := make(chan bool)
watcher, _ = fsnotify.NewWatcher()
defer func(){
watcher.Close()
wg.Done()
}()
walk := func(path string, info os.FileInfo, err error) error{
if !Ignore(path,p.Watcher.Ignore) {
@ -59,7 +63,13 @@ func (p *Project) Watching(){
for _, dir := range p.Watcher.Paths {
base, _ := os.Getwd()
// check path existence
// check main existence
if _, err := os.Stat(base + p.Path + dir + p.Main); err != nil {
Fail(p.Name + ": \t"+base + p.Path + dir + p.Main+ " doesn't exist. Main is required")
return
}
// check paths existence
if _, err := os.Stat(base + p.Path + dir); err == nil {
if err := filepath.Walk(base + p.Path + dir, walk); err != nil {
Fail(err.Error())
@ -99,9 +109,6 @@ func (p *Project) Watching(){
Fail(err.Error())
}
}
watcher.Close()
wg.Done()
}
func (p *Project) install(){