Merge pull request #1743 from gpatarin/issue-1741-savetorrentas
Fix for issue #1741 (Save Torrent File As...)
This commit is contained in:
@@ -296,18 +296,19 @@ module.exports = class TorrentListController {
|
|||||||
filters: [
|
filters: [
|
||||||
{ name: 'Torrent Files', extensions: ['torrent'] },
|
{ name: 'Torrent Files', extensions: ['torrent'] },
|
||||||
{ name: 'All Files', extensions: ['*'] }
|
{ name: 'All Files', extensions: ['*'] }
|
||||||
]
|
],
|
||||||
|
buttonLabel: 'Save'
|
||||||
}
|
}
|
||||||
|
|
||||||
electron.remote.dialog.showSaveDialog(win, opts, function (savePath) {
|
const savePath = electron.remote.dialog.showSaveDialogSync(win, opts)
|
||||||
console.log('Saving torrent ' + torrentKey + ' to ' + savePath)
|
|
||||||
if (!savePath) return // They clicked Cancel
|
if (!savePath) return // They clicked Cancel
|
||||||
const torrentPath = TorrentSummary.getTorrentPath(torrentSummary)
|
console.log('Saving torrent ' + torrentKey + ' to ' + savePath)
|
||||||
fs.readFile(torrentPath, function (err, torrentFile) {
|
const torrentPath = TorrentSummary.getTorrentPath(torrentSummary)
|
||||||
|
fs.readFile(torrentPath, function (err, torrentFile) {
|
||||||
|
if (err) return dispatch('error', err)
|
||||||
|
fs.writeFile(savePath, torrentFile, function (err) {
|
||||||
if (err) return dispatch('error', err)
|
if (err) return dispatch('error', err)
|
||||||
fs.writeFile(savePath, torrentFile, function (err) {
|
|
||||||
if (err) return dispatch('error', err)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user