This commit is contained in:
Liang Ding 2022-07-17 12:22:32 +08:00
parent c8ea858976
commit 505b973c2d
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
70 changed files with 671 additions and 942 deletions

View file

@ -23,6 +23,7 @@ import (
"time"
"github.com/fsnotify/fsnotify"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/cache"
"github.com/siyuan-note/siyuan/kernel/util"
)
@ -47,7 +48,7 @@ func watchAssets() {
var err error
if assetsWatcher, err = fsnotify.NewWatcher(); nil != err {
util.LogErrorf("add assets watcher for folder [%s] failed: %s", assetsDir, err)
logging.LogErrorf("add assets watcher for folder [%s] failed: %s", assetsDir, err)
return
}
@ -72,9 +73,9 @@ func watchAssets() {
if !ok {
return
}
util.LogErrorf("watch assets failed: %s", err)
logging.LogErrorf("watch assets failed: %s", err)
case <-timer.C:
//util.LogInfof("assets changed: %s", lastEvent)
//logging.LogInfof("assets changed: %s", lastEvent)
if lastEvent.Op&fsnotify.Write == fsnotify.Write {
// 外部修改已有资源文件后纳入云端同步 https://github.com/siyuan-note/siyuan/issues/4694
IncSync()
@ -87,9 +88,9 @@ func watchAssets() {
}()
if err = assetsWatcher.Add(assetsDir); err != nil {
util.LogErrorf("add assets watcher for folder [%s] failed: %s", assetsDir, err)
logging.LogErrorf("add assets watcher for folder [%s] failed: %s", assetsDir, err)
}
//util.LogInfof("added file watcher [%s]", assetsDir)
//logging.LogInfof("added file watcher [%s]", assetsDir)
}
func CloseWatchAssets() {