mirror of
https://github.com/beego/bee.git
synced 2024-11-21 23:50:54 +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)
|
||||
}
|
||||
}
|
||||
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
}()
|
||||
|
||||
colorLog("[INFO] Initializing watcher...\n")
|
||||
@ -70,16 +72,17 @@ func NewWatcher(paths []string) {
|
||||
|
||||
// getFileModTime retuens unix timestamp of `os.File.ModTime` by given path.
|
||||
func getFileModTime(path string) int64 {
|
||||
path = strings.Replace(path, "\\", "/", -1)
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
colorLog("[ERRO] Fail to open file[ %s ]", err)
|
||||
colorLog("[ERRO] Fail to open file[ %s ]\n", err)
|
||||
return time.Now().Unix()
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
fi, err := f.Stat()
|
||||
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()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user