diff --git a/main.js b/main.js index 9eaf937e..2657e39d 100644 --- a/main.js +++ b/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, ipcMain, nativeImage, dialog, Menu, globalShortcut} = require('electron') +const { app, BrowserWindow, ipcMain, nativeImage, dialog, Menu, globalShortcut, shell} = require('electron') const { autoUpdater } = require("electron-updater") const fs = require('fs') const mkdirp = require('mkdirp') @@ -223,6 +223,10 @@ ipcMain.handle('titlebarClick', (event, arg) => { } }) +ipcMain.handle('showItemInFolder', (event, arg) => { + shell.showItemInFolder(arg) +}) + //Check if user has enabled auto-updating the app function isUpdateEnabled() { let settingsPath diff --git a/modules/UI.js b/modules/UI.js index 27790d51..1ae6dd03 100644 --- a/modules/UI.js +++ b/modules/UI.js @@ -220,15 +220,15 @@ function openDownloadedFile() { } else { if(mediaMode === "audio") { if(process.platform === "darwin" || process.platform === "linux") { - shell.showItemInFolder(downloadPath + '/' + audioOutputName.replace(/[//?%*:|"<>]/g, '_')) + ipcRenderer.invoke('showItemInFolder', + '/' + audioOutputName.replace(/[//?%*:|"<>]/g, '_')) } else { - shell.showItemInFolder(downloadPath + '\\' + audioOutputName.replace(/[/\\?%*:|"<>]/g, '_')) + ipcRenderer.invoke('showItemInFolder', + '\\' + audioOutputName.replace(/[/\\?%*:|"<>]/g, '_')) } } else { if(process.platform === "darwin" || process.platform === "linux") { - shell.showItemInFolder(downloadPath + '/' + videoOutputName.replace(/[//?%*:|"<>]/g, '_')) + ipcRenderer.invoke('showItemInFolder', downloadPath + '/' + videoOutputName.replace(/[//?%*:|"<>]/g, '_')) } else { - shell.showItemInFolder(downloadPath + '\\' + videoOutputName.replace(/[/\\?%*:|"<>]/g, '_')) + ipcRenderer.invoke('showItemInFolder', downloadPath + '\\' + videoOutputName.replace(/[/\\?%*:|"<>]/g, '_')) } } }