From b9efc9d317885b91ccb2d2395568d8670c1ca7d4 Mon Sep 17 00:00:00 2001 From: asoseil Date: Tue, 9 Jan 2018 00:40:22 +0100 Subject: [PATCH] validate method improved --- realize/projects.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/realize/projects.go b/realize/projects.go index 6f93f2a..27088a2 100644 --- a/realize/projects.go +++ b/realize/projects.go @@ -335,7 +335,7 @@ L: } // Validate a file path -func (p *Project) Validate(path string, fiche bool) bool { +func (p *Project) Validate(path string, fcheck bool) bool { if len(path) <= 0 { return false } @@ -349,6 +349,10 @@ func (p *Project) Validate(path string, fiche bool) bool { if !array(e, p.Watcher.Exts) { return false } + }else{ + if !array(filepath.Base(path), p.Watcher.Paths) { + return false + } } separator := string(os.PathSeparator) // supported paths @@ -360,8 +364,11 @@ func (p *Project) Validate(path string, fiche bool) bool { } } // file check - if fiche { + if fcheck { fi, err := os.Stat(path) + if !fi.IsDir() && ext(path) == ""{ + return false + } if err != nil { return false }