check prefix

This commit is contained in:
alessio 2016-08-22 20:30:32 +02:00
parent 6a04665454
commit 31b6b0329d
1 changed files with 2 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package realize
import ( import (
"fmt" "fmt"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
"golang.org/x/tools/go/gcimporter15/testdata"
"gopkg.in/urfave/cli.v2" "gopkg.in/urfave/cli.v2"
"log" "log"
"math/big" "math/big"
@ -77,7 +78,7 @@ func (p *Project) Watching() {
walk := func(path string, info os.FileInfo, err error) error { walk := func(path string, info os.FileInfo, err error) error {
if !p.ignore(path) { if !p.ignore(path) {
if (info.IsDir() && len(filepath.Ext(path)) == 0 && !strings.Contains(path, "/.")) || (inArray(filepath.Ext(path), p.Watcher.Exts)) { if (info.IsDir() && len(filepath.Ext(path)) == 0 && !strings.HasPrefix(path, ".")) || (inArray(filepath.Ext(path), p.Watcher.Exts)) {
if p.Watcher.Preview { if p.Watcher.Preview {
fmt.Println(pname(p.Name, 1) + ": \t" + path) fmt.Println(pname(p.Name, 1) + ": \t" + path)
} }
@ -106,7 +107,6 @@ func (p *Project) Watching() {
p.base = base + p.Path p.base = base + p.Path
for _, dir := range p.Watcher.Paths { for _, dir := range p.Watcher.Paths {
dir = slash(dir) dir = slash(dir)
base = p.base + dir base = p.base + dir
if _, err := os.Stat(base); err == nil { if _, err := os.Stat(base); err == nil {
if err := filepath.Walk(base, walk); err != nil { if err := filepath.Walk(base, walk); err != nil {