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
*/
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')

View File

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

View File

@@ -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

View File

@@ -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(),

View File

@@ -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