walk fixed for hidden directories

This commit is contained in:
alessio 2016-08-23 09:43:38 +02:00
parent 66c858d9c1
commit e71d3ba877
2 changed files with 11 additions and 2 deletions

View File

@ -19,22 +19,31 @@ const (
)
var wg sync.WaitGroup
// Green color bold
var Green = color.New(color.FgGreen, color.Bold).SprintFunc()
// Red color bold
var Red = color.New(color.FgRed, color.Bold).SprintFunc()
// RedS color used for errors
var RedS = color.New(color.FgRed).SprintFunc()
// Blue color bold used for project output
var Blue = color.New(color.FgBlue, color.Bold).SprintFunc()
// BlueS color
var BlueS = color.New(color.FgBlue).SprintFunc()
// Yellow color bold
var Yellow = color.New(color.FgYellow, color.Bold).SprintFunc()
// YellowS color
var YellowS = color.New(color.FgYellow).SprintFunc()
// MagentaS color
var MagentaS = color.New(color.FgMagenta).SprintFunc()
// Magenta color bold
var Magenta = color.New(color.FgMagenta, color.Bold).SprintFunc()

View File

@ -76,9 +76,9 @@ func (p *Project) watching() {
walk := func(path string, info os.FileInfo, err error) error {
if !p.ignore(path) {
if (info.IsDir() && len(filepath.Ext(path)) == 0 && !strings.HasPrefix(path, ".")) || (inArray(filepath.Ext(path), p.Watcher.Exts)) {
if (info.IsDir() && len(filepath.Ext(path)) == 0 && !strings.HasPrefix(path, ".")) && !strings.Contains(path, "/.") || (inArray(filepath.Ext(path), p.Watcher.Exts)) {
if p.Watcher.Preview {
fmt.Println(pname(p.Name, 1) + ": \t" + path)
fmt.Println(pname(p.Name, 1), ":", path)
}
if err = watcher.Add(path); err != nil {
return filepath.SkipDir