From 0dbc8c293342bdfdc4e3f4b9318cc5467de10e86 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 1 Oct 2024 23:19:04 +0800 Subject: [PATCH] :art: Improve performance of exporting .sy.zip for notebook https://github.com/siyuan-note/siyuan/issues/12653 --- kernel/model/export.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/model/export.go b/kernel/model/export.go index 72f9469fd9e..b4a07469f2f 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -1567,6 +1567,8 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) ( util.PushEndlessProgress(Conf.Language(65)) // 按文件夹结构复制选择的树 + count := 0 + total := len(trees) + len(refTrees) for _, tree := range trees { readPath := filepath.Join(util.DataDir, tree.Box, tree.Path) data, readErr := filelock.ReadFile(readPath) @@ -1586,6 +1588,9 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) ( logging.LogErrorf("write export file [%s] failed: %s", writePath, writeErr) continue } + count++ + + util.PushEndlessProgress(fmt.Sprintf(Conf.Language(66), fmt.Sprintf("%d/%d ", count, total)+tree.HPath)) } // 引用树放在导出文件夹根路径下 @@ -1603,6 +1608,9 @@ func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) ( logging.LogErrorf("write export file [%s] failed: %s", writePath, writeErr) continue } + count++ + + util.PushEndlessProgress(fmt.Sprintf(Conf.Language(66), fmt.Sprintf("%d/%d ", count, total)+tree.HPath)) } // 将引用树合并到选择树中,以便后面一次性导出资源文件