SDA-1732 Checking for the existance of file before attempting to open it

This commit is contained in:
Mattias Gustavsson 2020-02-04 14:12:56 +01:00
parent 119da410dc
commit f6c7761f87

View File

@ -358,7 +358,10 @@ export const downloadManagerAction = (type, filePath): void => {
} }
if (type === 'open') { if (type === 'open') {
const openResponse = electron.shell.openItem(`${filePath}`); let openResponse = fs.existsSync(`${filePath}`);
if (openResponse) {
openResponse = electron.shell.openItem(`${filePath}`);
}
if (!openResponse && focusedWindow && !focusedWindow.isDestroyed()) { if (!openResponse && focusedWindow && !focusedWindow.isDestroyed()) {
electron.dialog.showMessageBox(focusedWindow, { electron.dialog.showMessageBox(focusedWindow, {
message, message,