diff --git a/src/renderer/controllers/torrent-list-controller.js b/src/renderer/controllers/torrent-list-controller.js index b723cf4d..1fa9f98a 100644 --- a/src/renderer/controllers/torrent-list-controller.js +++ b/src/renderer/controllers/torrent-list-controller.js @@ -299,15 +299,15 @@ module.exports = class TorrentListController { ] } - electron.remote.dialog.showSaveDialog(win, opts, function (savePath) { - console.log('Saving torrent ' + torrentKey + ' to ' + savePath) - if (!savePath) return // They clicked Cancel - const torrentPath = TorrentSummary.getTorrentPath(torrentSummary) - fs.readFile(torrentPath, function (err, torrentFile) { + const savePath = electron.remote.dialog.showSaveDialogSync(win, opts) + + console.log('Saving torrent ' + torrentKey + ' to ' + savePath) + if (!savePath) return // They clicked Cancel + 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) - fs.writeFile(savePath, torrentFile, function (err) { - if (err) return dispatch('error', err) - }) }) }) }