fix build

This commit is contained in:
codetypes committed 2024-04-17 11:33:39 +08:00
1 parent 809f8c1461
commit 708102e67b
1 file changed
+20 -19
+20 -19
View File
@@ -231,26 +231,27 @@ export const useWorkspace = create<WorkspaceStore>((set, get) => ({
buildProject: () => { buildProject: () => {
const workspace = get(); const workspace = get();
if (!buildDir && workspace.path) { if (workspace.path)
buildDir = dialog.showOpenDialogSync({ if (!buildDir) {
properties: ["openDirectory", "createDirectory"], buildDir = dialog.showOpenDialogSync({
})?.[0]; properties: ["openDirectory", "createDirectory"],
if (buildDir) { })?.[0];
for (const editor of workspace.editors) { }
editor.dispatch?.("save"); if (buildDir) {
} for (const editor of workspace.editors) {
try { editor.dispatch?.("save");
for (const path of workspace.allFiles) { }
const buildpath = buildDir + "/" + Path.relative(workspace.workdir, path); try {
console.log("build:", buildpath); for (const path of workspace.allFiles) {
const treeModel = b3util.createBuildData(path); const buildpath = buildDir + "/" + Path.relative(workspace.workdir, path);
fs.mkdirSync(Path.dirname(buildpath), { recursive: true }); console.log("build:", buildpath);
fs.writeFileSync(buildpath, JSON.stringify(treeModel, null, 2)); const treeModel = b3util.createBuildData(path);
} fs.mkdirSync(Path.dirname(buildpath), { recursive: true });
message.success(i18n.t("buildCompleted")); fs.writeFileSync(buildpath, JSON.stringify(treeModel, null, 2));
} catch (error) {
console.error(error);
} }
message.success(i18n.t("buildCompleted"));
} catch (error) {
console.error(error);
} }
} }
}, },