mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-11 22:51:20 +08:00
✨ Support for searching asset content https://github.com/siyuan-note/siyuan/issues/8874
This commit is contained in:
parent
0c0c6834c6
commit
a169b3913a
@ -444,9 +444,12 @@ func copyTempAsset(absPath string) (ret string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filelock.RWLock.Lock()
|
||||||
|
defer filelock.RWLock.Unlock()
|
||||||
|
|
||||||
ret = filepath.Join(dir, gulu.Rand.String(7)+".docx")
|
ret = filepath.Join(dir, gulu.Rand.String(7)+".docx")
|
||||||
if err := filelock.Copy(absPath, ret); nil != err {
|
if err := gulu.File.Copy(absPath, ret); nil != err {
|
||||||
logging.LogErrorf("copy [%s] to [%s] failed: [%s]", absPath, ret, err)
|
logging.LogErrorf("copy [src=%s, dest=%s] failed: %s", absPath, ret, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -73,6 +73,11 @@ func watchAssets() {
|
|||||||
|
|
||||||
lastEvent = event
|
lastEvent = event
|
||||||
timer.Reset(time.Millisecond * 100)
|
timer.Reset(time.Millisecond * 100)
|
||||||
|
|
||||||
|
if lastEvent.Op&fsnotify.Rename == fsnotify.Rename {
|
||||||
|
// 索引资源文件内容
|
||||||
|
IndexAssetContent(lastEvent.Name)
|
||||||
|
}
|
||||||
case err, ok := <-assetsWatcher.Errors:
|
case err, ok := <-assetsWatcher.Errors:
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user