mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
🎨 /资源 支持搜索未索引的文件 https://github.com/siyuan-note/siyuan/issues/5416
This commit is contained in:
parent
e0af974bf8
commit
d62d929a18
1 changed files with 6 additions and 0 deletions
6
kernel/cache/asset.go
vendored
6
kernel/cache/asset.go
vendored
|
|
@ -21,6 +21,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
)
|
)
|
||||||
|
|
@ -34,6 +35,7 @@ type Asset struct {
|
||||||
var Assets = sync.Map{}
|
var Assets = sync.Map{}
|
||||||
|
|
||||||
func LoadAssets() {
|
func LoadAssets() {
|
||||||
|
start := time.Now()
|
||||||
Assets = sync.Map{}
|
Assets = sync.Map{}
|
||||||
assets := filepath.Join(util.DataDir, "assets")
|
assets := filepath.Join(util.DataDir, "assets")
|
||||||
filepath.Walk(assets, func(path string, info fs.FileInfo, err error) error {
|
filepath.Walk(assets, func(path string, info fs.FileInfo, err error) error {
|
||||||
|
|
@ -56,4 +58,8 @@ func LoadAssets() {
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
elapsed := time.Since(start)
|
||||||
|
if 2000 < elapsed.Milliseconds() {
|
||||||
|
util.LogInfof("loaded assets [%s]", elapsed)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue