mirror of
https://github.com/beego/bee.git
synced 2024-11-24 18:30:53 +00:00
Update
This commit is contained in:
parent
3d3b109b8a
commit
7daaa6b523
7
watch.go
7
watch.go
@ -54,6 +54,8 @@ func NewWatcher(paths []string) {
|
|||||||
log.Fatal("error:", err)
|
log.Fatal("error:", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
time.Sleep(500 * time.Millisecond)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
colorLog("[INFO] Initializing watcher...\n")
|
colorLog("[INFO] Initializing watcher...\n")
|
||||||
@ -70,16 +72,17 @@ func NewWatcher(paths []string) {
|
|||||||
|
|
||||||
// getFileModTime retuens unix timestamp of `os.File.ModTime` by given path.
|
// getFileModTime retuens unix timestamp of `os.File.ModTime` by given path.
|
||||||
func getFileModTime(path string) int64 {
|
func getFileModTime(path string) int64 {
|
||||||
|
path = strings.Replace(path, "\\", "/", -1)
|
||||||
f, err := os.Open(path)
|
f, err := os.Open(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
colorLog("[ERRO] Fail to open file[ %s ]", err)
|
colorLog("[ERRO] Fail to open file[ %s ]\n", err)
|
||||||
return time.Now().Unix()
|
return time.Now().Unix()
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
fi, err := f.Stat()
|
fi, err := f.Stat()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
colorLog("[ERRO] Fail to get file information[ %s ]", err)
|
colorLog("[ERRO] Fail to get file information[ %s ]\n", err)
|
||||||
return time.Now().Unix()
|
return time.Now().Unix()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user