diff --git a/main/ipc.js b/main/ipc.js index 0b2fe1ad..08e305ff 100644 --- a/main/ipc.js +++ b/main/ipc.js @@ -50,6 +50,11 @@ function init () { windows.main.setTitle(title) }) + ipcMain.on('openItem', function (e, path) { + console.log('opening file or folder: ' + path) + electron.shell.openItem(path) + }) + ipcMain.on('blockPowerSave', blockPowerSave) ipcMain.on('unblockPowerSave', unblockPowerSave) diff --git a/renderer/index.js b/renderer/index.js index 91d668a6..4ed209bb 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -564,7 +564,14 @@ function openFolder (torrentSummary) { if (!torrent) return var folderPath = path.join(torrent.path, torrent.name) - ipcRenderer.send('openItem', folderPath) + // Multi-file torrents create their own folder, single file torrents just + // drop the file directly into the Downloads folder + fs.stat(folderPath, function (err, stats) { + if (err || !stats.isDirectory()) { + folderPath = torrent.path + } + ipcRenderer.send('openItem', folderPath) + }) } function closePlayer () {