fixes for Electron 9

This commit is contained in:
Feross Aboukhadijeh
2020-07-15 14:35:03 -07:00
parent 1f19ed9a2d
commit 27bbdcc465
5 changed files with 10 additions and 10 deletions

View File

@@ -141,9 +141,9 @@ function init () {
* Shell * Shell
*/ */
ipc.on('openItem', (e, ...args) => { ipc.on('openPath', (e, ...args) => {
const shell = require('./shell') const shell = require('./shell')
shell.openItem(...args) shell.openPath(...args)
}) })
ipc.on('showItemInFolder', (e, ...args) => { ipc.on('showItemInFolder', (e, ...args) => {
const shell = require('./shell') const shell = require('./shell')

View File

@@ -1,6 +1,6 @@
module.exports = { module.exports = {
openExternal, openExternal,
openItem, openPath,
showItemInFolder, showItemInFolder,
moveItemToTrash moveItemToTrash
} }
@@ -19,9 +19,9 @@ function openExternal (url) {
/** /**
* Open the given file in the desktops default manner. * Open the given file in the desktops default manner.
*/ */
function openItem (path) { function openPath (path) {
log(`openItem: ${path}`) log(`openPath: ${path}`)
electron.shell.openItem(path) electron.shell.openPath(path)
} }
/** /**

View File

@@ -61,12 +61,12 @@ module.exports = class PlaybackController {
} }
// Open a file in OS default app. // Open a file in OS default app.
openItem (infoHash, index) { openPath (infoHash, index) {
const torrentSummary = TorrentSummary.getByKey(this.state, infoHash) const torrentSummary = TorrentSummary.getByKey(this.state, infoHash)
const filePath = path.join( const filePath = path.join(
torrentSummary.path, torrentSummary.path,
torrentSummary.files[index].path) torrentSummary.files[index].path)
ipcRenderer.send('openItem', filePath) ipcRenderer.send('openPath', filePath)
} }
// Toggle (play or pause) the currently playing media // Toggle (play or pause) the currently playing media

View File

@@ -280,7 +280,7 @@ const dispatchHandlers = {
changePlaybackRate: (dir) => controllers.playback().changePlaybackRate(dir), changePlaybackRate: (dir) => controllers.playback().changePlaybackRate(dir),
changeVolume: (delta) => controllers.playback().changeVolume(delta), changeVolume: (delta) => controllers.playback().changeVolume(delta),
setVolume: (vol) => controllers.playback().setVolume(vol), setVolume: (vol) => controllers.playback().setVolume(vol),
openItem: (infoHash, index) => controllers.playback().openItem(infoHash, index), openPath: (infoHash, index) => controllers.playback().openPath(infoHash, index),
// Subtitles // Subtitles
openSubtitles: () => controllers.subtitles().openSubtitles(), openSubtitles: () => controllers.subtitles().openSubtitles(),

View File

@@ -346,7 +346,7 @@ module.exports = class TorrentList extends React.Component {
} else { } else {
icon = 'description' /* file icon, opens in OS default app */ icon = 'description' /* file icon, opens in OS default app */
handleClick = isDone handleClick = isDone
? dispatcher('openItem', infoHash, index) ? dispatcher('openPath', infoHash, index)
: (e) => e.stopPropagation() // noop if file is not ready : (e) => e.stopPropagation() // noop if file is not ready
} }
// TODO: add a css 'disabled' class to indicate that a file cannot be opened/streamed // TODO: add a css 'disabled' class to indicate that a file cannot be opened/streamed