show message when parse subtree error

This commit is contained in:
codetypes committed 2024-03-12 10:03:51 +08:00
1 parent 1013bb4f5e
commit fcf11a38cd
3 files changed
+3 -5

No files matched your search

+1 -1
View File
@@ -117,11 +117,11 @@ export const createTreeData = (bNode: BehaviorNodeModel, settings: Settings, par
try { try {
const subtreePath = settings.workdir + "/" + bNode.path; const subtreePath = settings.workdir + "/" + bNode.path;
const str = fs.readFileSync(subtreePath, "utf8"); const str = fs.readFileSync(subtreePath, "utf8");
console.log("read subtree:", subtreePath);
treeData = createTreeData(JSON.parse(str).root, settings, treeData.id); treeData = createTreeData(JSON.parse(str).root, settings, treeData.id);
treeData.path = bNode.path; treeData.path = bNode.path;
treeData.size = calcTreeNodeSize(treeData); treeData.size = calcTreeNodeSize(treeData);
} catch (error) { } catch (error) {
message.error(`解析子树失败:${bNode.path}`);
console.log("parse subtree:", error); console.log("parse subtree:", error);
} }
parsingStack.pop(); parsingStack.pop();
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "behavior3editor", "name": "behavior3editor",
"version": "0.2.1", "version": "0.2.2",
"description": "行为树编辑器", "description": "行为树编辑器",
"main": "./dist/main.js", "main": "./dist/main.js",
"scripts": { "scripts": {
+1 -3
View File
@@ -79,11 +79,9 @@ export default class TreeTabs extends Component<TreeTabsProps, TreeTabsState> {
} }
const settings = Utils.getRemoteSettings(); const settings = Utils.getRemoteSettings();
const workdir = settings.workdir; const files = fs.readdirSync(settings.workdir).filter((f) => {
const files = fs.readdirSync(workdir).filter((f) => {
return f.endsWith(".json"); return f.endsWith(".json");
}); });
fs.mkdirSync(workdir + "/../build", { recursive: true });
for (const path of files) { for (const path of files) {
const buildpath = buildDir + "/" + path; const buildpath = buildDir + "/" + path;
console.log("build:", buildpath); console.log("build:", buildpath);