Skip to content

Commit

Permalink
Merge pull request #11 from lukaswagner/fix/5_file_select_assertion_e…
Browse files Browse the repository at this point in the history
…rror

closes #5: use async file dialog to avoid electron bug
  • Loading branch information
lukaswagner committed Nov 23, 2021
2 parents aa3cf15 + 39c3650 commit 5b4703e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ui/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,16 @@ ipc.on('answer', (event, data) => {
runningProcess.send(data);
});

ipc.handle('select', (event, data) => {
ipc.handle('select', async (event, data) => {
const properties = [];
if (data.includes('d')) properties.push('openDirectory', 'createDirectory');
if (data.includes('f')) properties.push('openFile');
return dialog.showOpenDialogSync({
const result = await dialog.showOpenDialog({
defaultPath: process.cwd(),
properties
})?.[0];
});
if (result?.canceled) return undefined;
return result?.filePaths[0];
});

ipc.handle('resolve', (event, data) => {
Expand Down

0 comments on commit 5b4703e

Please sign in to comment.