From 27bbdcc4653d545c98e4b3d98a5577c9f060e562 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 15 Jul 2020 14:35:03 -0700 Subject: [PATCH] fixes for Electron 9 --- src/main/ipc.js | 4 ++-- src/main/shell.js | 8 ++++---- src/renderer/controllers/playback-controller.js | 4 ++-- src/renderer/main.js | 2 +- src/renderer/pages/torrent-list-page.js | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/ipc.js b/src/main/ipc.js index 216b7e5f..29deb97d 100644 --- a/src/main/ipc.js +++ b/src/main/ipc.js @@ -141,9 +141,9 @@ function init () { * Shell */ - ipc.on('openItem', (e, ...args) => { + ipc.on('openPath', (e, ...args) => { const shell = require('./shell') - shell.openItem(...args) + shell.openPath(...args) }) ipc.on('showItemInFolder', (e, ...args) => { const shell = require('./shell') diff --git a/src/main/shell.js b/src/main/shell.js index cd133fe6..1a32d53e 100644 --- a/src/main/shell.js +++ b/src/main/shell.js @@ -1,6 +1,6 @@ module.exports = { openExternal, - openItem, + openPath, showItemInFolder, moveItemToTrash } @@ -19,9 +19,9 @@ function openExternal (url) { /** * Open the given file in the desktop’s default manner. */ -function openItem (path) { - log(`openItem: ${path}`) - electron.shell.openItem(path) +function openPath (path) { + log(`openPath: ${path}`) + electron.shell.openPath(path) } /** diff --git a/src/renderer/controllers/playback-controller.js b/src/renderer/controllers/playback-controller.js index 413ccd2d..fc8b3205 100644 --- a/src/renderer/controllers/playback-controller.js +++ b/src/renderer/controllers/playback-controller.js @@ -61,12 +61,12 @@ module.exports = class PlaybackController { } // Open a file in OS default app. - openItem (infoHash, index) { + openPath (infoHash, index) { const torrentSummary = TorrentSummary.getByKey(this.state, infoHash) const filePath = path.join( torrentSummary.path, torrentSummary.files[index].path) - ipcRenderer.send('openItem', filePath) + ipcRenderer.send('openPath', filePath) } // Toggle (play or pause) the currently playing media diff --git a/src/renderer/main.js b/src/renderer/main.js index 8f5f8a9e..7592dc0d 100644 --- a/src/renderer/main.js +++ b/src/renderer/main.js @@ -280,7 +280,7 @@ const dispatchHandlers = { changePlaybackRate: (dir) => controllers.playback().changePlaybackRate(dir), changeVolume: (delta) => controllers.playback().changeVolume(delta), setVolume: (vol) => controllers.playback().setVolume(vol), - openItem: (infoHash, index) => controllers.playback().openItem(infoHash, index), + openPath: (infoHash, index) => controllers.playback().openPath(infoHash, index), // Subtitles openSubtitles: () => controllers.subtitles().openSubtitles(), diff --git a/src/renderer/pages/torrent-list-page.js b/src/renderer/pages/torrent-list-page.js index 58425bca..cd14b63b 100644 --- a/src/renderer/pages/torrent-list-page.js +++ b/src/renderer/pages/torrent-list-page.js @@ -346,7 +346,7 @@ module.exports = class TorrentList extends React.Component { } else { icon = 'description' /* file icon, opens in OS default app */ handleClick = isDone - ? dispatcher('openItem', infoHash, index) + ? dispatcher('openPath', infoHash, index) : (e) => e.stopPropagation() // noop if file is not ready } // TODO: add a css 'disabled' class to indicate that a file cannot be opened/streamed