🎨 /资源 支持搜索未索引的文件 https://github.com/siyuan-note/siyuan/issues/5416

This commit is contained in:
Liang Ding 2022-07-15 09:39:25 +08:00
parent e0af974bf8
commit d62d929a18
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -21,6 +21,7 @@ import (
"path/filepath"
"strings"
"sync"
"time"
"github.com/siyuan-note/siyuan/kernel/util"
)
@ -34,6 +35,7 @@ type Asset struct {
var Assets = sync.Map{}
func LoadAssets() {
start := time.Now()
Assets = sync.Map{}
assets := filepath.Join(util.DataDir, "assets")
filepath.Walk(assets, func(path string, info fs.FileInfo, err error) error {
@ -56,4 +58,8 @@ func LoadAssets() {
})
return nil
})
elapsed := time.Since(start)
if 2000 < elapsed.Milliseconds() {
util.LogInfof("loaded assets [%s]", elapsed)
}
}