mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-27 11:58:49 +01:00
🎨 重命名资源文件不再需要等待数据写入 Fix https://github.com/siyuan-note/siyuan/issues/7133
This commit is contained in:
parent
2574163af9
commit
ed68551477
6 changed files with 8 additions and 8 deletions
|
|
@ -502,8 +502,10 @@ func RenameAsset(oldPath, newName string) (err error) {
|
|||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
||||
for _, notebook := range notebooks {
|
||||
pages := pagedPaths(filepath.Join(util.DataDir, notebook.ID), 32)
|
||||
|
||||
for _, paths := range pages {
|
||||
for _, treeAbsPath := range paths {
|
||||
data, readErr := filelock.ReadFile(treeAbsPath)
|
||||
|
|
@ -513,6 +515,7 @@ func RenameAsset(oldPath, newName string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
util.PushEndlessProgress(fmt.Sprintf(Conf.Language(70), filepath.Base(treeAbsPath)))
|
||||
if !bytes.Contains(data, []byte(oldName)) {
|
||||
continue
|
||||
}
|
||||
|
|
@ -541,9 +544,6 @@ func RenameAsset(oldPath, newName string) (err error) {
|
|||
}
|
||||
|
||||
IncSync()
|
||||
|
||||
util.PushEndlessProgress(Conf.Language(113))
|
||||
sql.WaitForWritingDatabase()
|
||||
util.ReloadUI()
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue