fix save subtree error on windows
This commit is contained in:
1 parent
5dab8220a5
commit
cd22671a3a
4 files changed
+11
-5
No files matched your search
@@ -103,6 +103,8 @@ async function createWindow(projectPath?: string) {
|
|||||||
nextWin.focus();
|
nextWin.focus();
|
||||||
nextWin.webContents.send("refresh-app-men");
|
nextWin.webContents.send("refresh-app-men");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
win.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
win.on("closed", () => {
|
win.on("closed", () => {
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "behavior3editor",
|
"name": "behavior3editor",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "behavior3editor",
|
"name": "behavior3editor",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "behavior3editor",
|
"name": "behavior3editor",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"main": "dist-electron/main/index.js",
|
"main": "dist-electron/main/index.js",
|
||||||
"description": "行为树编辑器",
|
"description": "行为树编辑器",
|
||||||
"author": "zhandouxiaojiji & codetypes",
|
"author": "zhandouxiaojiji & codetypes",
|
||||||
|
|||||||
@@ -451,18 +451,22 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const subpath = dialog.showSaveDialogSync({
|
let subpath = dialog.showSaveDialogSync({
|
||||||
defaultPath: workspace.workdir,
|
defaultPath: workspace.workdir,
|
||||||
properties: ["showOverwriteConfirmation"],
|
properties: ["showOverwriteConfirmation"],
|
||||||
filters: [{ name: "Json", extensions: ["json"] }],
|
filters: [{ name: "Json", extensions: ["json"] }],
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!subpath) {
|
if (!subpath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subpath = subpath.replaceAll(Path.sep, "/");
|
||||||
if (subpath.indexOf(workspace.workdir) == -1) {
|
if (subpath.indexOf(workspace.workdir) == -1) {
|
||||||
message.warning(t("node.subtreePathError"));
|
message.warning(t("node.subtreePathError"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = findDataById(editor.selectedId!);
|
const data = findDataById(editor.selectedId!);
|
||||||
const subroot = b3util.createFileData(data);
|
const subroot = b3util.createFileData(data);
|
||||||
const subtreeModel = {
|
const subtreeModel = {
|
||||||
@@ -471,7 +475,7 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
|
|||||||
desc: data.desc,
|
desc: data.desc,
|
||||||
} as TreeModel;
|
} as TreeModel;
|
||||||
fs.writeFileSync(subpath, JSON.stringify(subtreeModel, null, 2));
|
fs.writeFileSync(subpath, JSON.stringify(subtreeModel, null, 2));
|
||||||
data.path = subpath.substring(workspace.workdir.length + 1);
|
data.path = Path.relative(workspace.workdir, subpath).replaceAll(Path.sep, "/");
|
||||||
reload();
|
reload();
|
||||||
pushHistory();
|
pushHistory();
|
||||||
onChange();
|
onChange();
|
||||||
|
|||||||
Reference in new issue
Block a user