修复 递归监听忽略主级目录的bug
This commit is contained in:
parent
22fca4f68e
commit
cae4bf355e
10
fileboy.go
10
fileboy.go
@ -34,7 +34,7 @@ var (
|
|||||||
|
|
||||||
type changeFile struct {
|
type changeFile struct {
|
||||||
Name string
|
Name string
|
||||||
changed int64
|
Changed int64
|
||||||
Ext string
|
Ext string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ func eventDispatcher(event fsnotify.Event) {
|
|||||||
}
|
}
|
||||||
go run(&changeFile{
|
go run(&changeFile{
|
||||||
Name: relativePath(projectFolder, event.Name),
|
Name: relativePath(projectFolder, event.Name),
|
||||||
changed: time.Now().UnixNano(),
|
Changed: time.Now().UnixNano(),
|
||||||
Ext: ext,
|
Ext: ext,
|
||||||
})
|
})
|
||||||
case fsnotify.Remove:
|
case fsnotify.Remove:
|
||||||
@ -143,12 +143,14 @@ func addWatcher() {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
|
md := projectFolder + "/" + darr[0]
|
||||||
if len(darr) == 2 && darr[1] == "*" {
|
if len(darr) == 2 && darr[1] == "*" {
|
||||||
listFile(projectFolder+"/"+darr[0], func(d string) {
|
dirs = arrayUniqueAdd(dirs, md)
|
||||||
|
listFile(md, func(d string) {
|
||||||
dirs = arrayUniqueAdd(dirs, d)
|
dirs = arrayUniqueAdd(dirs, d)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
dirs = arrayUniqueAdd(dirs, projectFolder+"/"+darr[0])
|
dirs = arrayUniqueAdd(dirs, md)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
util.go
2
util.go
@ -32,7 +32,7 @@ func strParseRealStr(s string, cf *changeFile) string {
|
|||||||
strings.Replace(s, "{{file}}", cf.Name, -1),
|
strings.Replace(s, "{{file}}", cf.Name, -1),
|
||||||
"{{ext}}", cf.Ext, -1,
|
"{{ext}}", cf.Ext, -1,
|
||||||
),
|
),
|
||||||
"{{changed}}", strconv.FormatInt(cf.changed, 10), -1,
|
"{{changed}}", strconv.FormatInt(cf.Changed, 10), -1,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user