Skip to content

Commit

Permalink
file dialog no error
Browse files Browse the repository at this point in the history
  • Loading branch information
steam0r committed Nov 11, 2024
1 parent f2a021a commit 4dcc6ef
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
16 changes: 11 additions & 5 deletions src/electron/electron_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class ElectronApi
}
else
{
return this.error("no project dir chosen", null, "info");
return this.error("no directory chosen", null, "info");
}
}
}
Expand Down Expand Up @@ -1267,7 +1267,6 @@ class ElectronApi
const projectFile = await electronApp.saveProjectFileDialog();
if (!projectFile)
{
logger.info("no project dir chosen");
return this.error("no project dir chosen", null, "info");
}

Expand Down Expand Up @@ -1362,7 +1361,7 @@ class ElectronApi
}
else
{
return this.error("no project dir chosen", [], "info");
return this.error("no directory chosen", [], "info");
}
}

Expand Down Expand Up @@ -1601,8 +1600,15 @@ class ElectronApi
{
let file = data.name;
let pickedFileUrl = await electronApp.saveFileDialog(file);
if (pickedFileUrl) fs.writeFileSync(pickedFileUrl, "");
return this.success("OK", pickedFileUrl, true);
if (pickedFileUrl)
{
fs.writeFileSync(pickedFileUrl, "");
return this.success("OK", pickedFileUrl, true);
}
else
{
return this.success("NO_DIR_CHOSEN", null, true);
}
}

async exportPatch()
Expand Down
1 change: 0 additions & 1 deletion src/export/export_zip_standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export default class StandaloneZipExport extends SharedExportService
else
{
const outputErr = "no export directory chosen";
this._log.error("export error", outputErr);
const result = { "error": outputErr };
callbackFinished(result);
}
Expand Down
14 changes: 10 additions & 4 deletions src_client/electron_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,17 @@ export default class ElectronEditor
{
this.api("createFile", data, (error, r) =>
{
if (error) this._talker.send("logError", { "level": error.level, "message": error.msg || error });
if (window.standalone && window.standalone.gui)
if (error)
{
this._talker.send("logError", { "level": error.level, "message": error.msg || error });
}
else
{
window.standalone.gui.patchView.addAssetOpAuto(r);
window.standalone.gui.fileManagerEditor.editAssetTextFile("file:" + r, "text");
if (window.standalone && window.standalone.gui && r)
{
window.standalone.gui.patchView.addAssetOpAuto(r);
window.standalone.gui.fileManagerEditor.editAssetTextFile("file:" + r, "text");
}
}
next(error, r);
});
Expand Down

0 comments on commit 4dcc6ef

Please sign in to comment.