mirror of
https://github.com/beego/bee.git
synced 2024-11-22 20:20:55 +00:00
Merge pull request #159 from youngsterxyf/develop
fix #1552 in beego, see: https://github.com/astaxie/beego/issues/1552
This commit is contained in:
commit
ba6fe73334
18
run.go
18
run.go
@ -134,7 +134,7 @@ func readAppDirectories(directory string, paths *[]string) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if isExcluded(fileInfo) {
|
if isExcluded(path.Join(directory, fileInfo.Name())) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,10 +157,20 @@ func readAppDirectories(directory string, paths *[]string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If a file is excluded
|
// If a file is excluded
|
||||||
func isExcluded(fileInfo os.FileInfo) bool {
|
func isExcluded(filePath string) bool {
|
||||||
for _, p := range excludedPaths {
|
for _, p := range excludedPaths {
|
||||||
if strings.HasSuffix(fileInfo.Name(), p) {
|
absP, err := path.Abs(p)
|
||||||
ColorLog("[INFO] Excluding from watching [ %s ]\n", fileInfo.Name())
|
if err != nil {
|
||||||
|
ColorLog("[ERROR] Can not get absolute path of [ %s ]\n", p)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
absFilePath, err := path.Abs(filePath)
|
||||||
|
if err != nil {
|
||||||
|
ColorLog("[ERROR] Can not get absolute path of [ %s ]\n", filePath)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(absFilePath, absP) {
|
||||||
|
ColorLog("[INFO] Excluding from watching [ %s ]\n", filePath)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user