Skip to content

Commit

Permalink
fix the open/save query functionality (#541)
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
  • Loading branch information
MasterOdin committed Nov 10, 2020
1 parent b16a846 commit 4e9ab84
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/renderer/utils/file-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ export function showSaveDialog(filters) {
return new Promise((resolve, reject) => {
remote.dialog.showSaveDialog({
filters,
}, (fileName) => {
if (fileName) {
return resolve(fileName);
}).then((dialogObject) => {
if (dialogObject.canceled) {
return reject();
}

return reject();
return resolve(dialogObject.filePath);
}).catch((err) => {
reject(err);
});
});
}
Expand All @@ -33,12 +34,13 @@ export function showOpenDialog(filters, defaultPath) {
defaultPath,
filters,
properties: ['openFile'],
}, (fileName) => {
if (fileName) {
return resolve(fileName);
}).then((dialogObject) => {
if (dialogObject.canceled || dialogObject.filePaths.length === 0) {
return reject();
}

return reject();
return resolve(dialogObject.filePaths);
}).catch((err) => {
reject(err);
});
});
}
Expand Down

0 comments on commit 4e9ab84

Please sign in to comment.