From fcf11a38cd6017df7614949187ab715a5ba680cd Mon Sep 17 00:00:00 2001 From: codetypes Date: Tue, 12 Mar 2024 10:03:51 +0800 Subject: [PATCH] show message when parse subtree error --- common/Utils.ts | 2 +- package.json | 2 +- render-process/TreeTabs.tsx | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/common/Utils.ts b/common/Utils.ts index c4a9a07..3c43d53 100644 --- a/common/Utils.ts +++ b/common/Utils.ts @@ -117,11 +117,11 @@ export const createTreeData = (bNode: BehaviorNodeModel, settings: Settings, par try { const subtreePath = settings.workdir + "/" + bNode.path; const str = fs.readFileSync(subtreePath, "utf8"); - console.log("read subtree:", subtreePath); treeData = createTreeData(JSON.parse(str).root, settings, treeData.id); treeData.path = bNode.path; treeData.size = calcTreeNodeSize(treeData); } catch (error) { + message.error(`解析子树失败:${bNode.path}`); console.log("parse subtree:", error); } parsingStack.pop(); diff --git a/package.json b/package.json index 512776c..f3d8a1e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "behavior3editor", - "version": "0.2.1", + "version": "0.2.2", "description": "行为树编辑器", "main": "./dist/main.js", "scripts": { diff --git a/render-process/TreeTabs.tsx b/render-process/TreeTabs.tsx index 7ba0657..2df783f 100644 --- a/render-process/TreeTabs.tsx +++ b/render-process/TreeTabs.tsx @@ -79,11 +79,9 @@ export default class TreeTabs extends Component { } const settings = Utils.getRemoteSettings(); - const workdir = settings.workdir; - const files = fs.readdirSync(workdir).filter((f) => { + const files = fs.readdirSync(settings.workdir).filter((f) => { return f.endsWith(".json"); }); - fs.mkdirSync(workdir + "/../build", { recursive: true }); for (const path of files) { const buildpath = buildDir + "/" + path; console.log("build:", buildpath);