Fix opening files and folders
This commit is contained in:
@@ -50,6 +50,11 @@ function init () {
|
|||||||
windows.main.setTitle(title)
|
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('blockPowerSave', blockPowerSave)
|
||||||
ipcMain.on('unblockPowerSave', unblockPowerSave)
|
ipcMain.on('unblockPowerSave', unblockPowerSave)
|
||||||
|
|
||||||
|
|||||||
@@ -564,7 +564,14 @@ function openFolder (torrentSummary) {
|
|||||||
if (!torrent) return
|
if (!torrent) return
|
||||||
|
|
||||||
var folderPath = path.join(torrent.path, torrent.name)
|
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 () {
|
function closePlayer () {
|
||||||
|
|||||||
Reference in New Issue
Block a user