From b10a7d99f8d813c9e49cff64b4e2fc2761ed2ae5 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 12 Aug 2022 10:43:24 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=94=B9=E8=BF=9B=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=AF=BB=E5=86=99=E5=9D=97=E6=A0=91=E6=96=87=E4=BB=B6=E5=90=8E?= =?UTF-8?q?=E7=9A=84=E5=A4=84=E7=90=86=20Fix=20https://github.com/siyuan-n?= =?UTF-8?q?ote/siyuan/issues/5619?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/electron/main.js | 2 +- kernel/model/conf.go | 3 +-- kernel/model/index.go | 38 -------------------------------------- 3 files changed, 2 insertions(+), 41 deletions(-) diff --git a/app/electron/main.js b/app/electron/main.js index 43c5346ee..eb0ae9fe0 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -529,7 +529,7 @@ const initKernel = (initData) => { break case 23: showErrorWindow('⚠️ 无法读写块树文件 Failed to access blocktree file', - `
块树文件正在被其他程序锁定。如果你使用了第三方同步盘,请在思源运行期间关闭同步。
The block tree file is being locked by another program. If you use a third-party sync disk, please turn off the sync while SiYuan is running.
`) + `
块树文件正在被其他程序锁定或者已经损坏,请删除 工作空间/temp/ 文件夹后重启
The block tree file is being locked by another program or is damaged, please delete the workspace/temp/ folder and restart.
`) break case 0: case 1: // Fatal error diff --git a/kernel/model/conf.go b/kernel/model/conf.go index 1a308f250..e0880c71c 100644 --- a/kernel/model/conf.go +++ b/kernel/model/conf.go @@ -510,9 +510,8 @@ func InitBoxes() { } for _, box := range Conf.GetOpenedBoxes() { - box.UpdateHistoryGenerated() // 初始化历史生成时间为当前时间 if !initialized { - box.BootIndex() + box.Index(true) } ListDocTree(box.ID, "/", Conf.FileTree.Sort) // 缓存根一级的文档树展开 diff --git a/kernel/model/index.go b/kernel/model/index.go index 18e245b45..6ecf9b96e 100644 --- a/kernel/model/index.go +++ b/kernel/model/index.go @@ -40,44 +40,6 @@ import ( "github.com/siyuan-note/siyuan/kernel/util" ) -func (box *Box) BootIndex() { - util.SetBootDetails("Listing files...") - files := box.ListFiles("/") - boxLen := len(Conf.GetOpenedBoxes()) - if 1 > boxLen { - boxLen = 1 - } - bootProgressPart := 10.0 / float64(boxLen) / float64(len(files)) - - luteEngine := NewLute() - i := 0 - // 读取并缓存路径映射 - for _, file := range files { - if file.isdir || !strings.HasSuffix(file.name, ".sy") { - continue - } - - p := file.path - tree, err := filesys.LoadTree(box.ID, p, luteEngine) - if nil != err { - logging.LogErrorf("read box [%s] tree [%s] failed: %s", box.ID, p, err) - continue - } - - docIAL := parse.IAL2MapUnEsc(tree.Root.KramdownIAL) - cache.PutDocIAL(p, docIAL) - - util.IncBootProgress(bootProgressPart, "Parsing tree "+util.ShortPathForBootingDisplay(tree.Path)) - // 缓存块树 - treenode.IndexBlockTree(tree) - if 1 < i && 0 == i%64 { - filelock.ReleaseAllFileLocks() - } - i++ - } - return -} - func (box *Box) Index(fullRebuildIndex bool) (treeCount int, treeSize int64) { defer debug.FreeOSMemory()