diff --git a/index.js b/index.js index 3925b60..0e8b8a6 100644 --- a/index.js +++ b/index.js @@ -157,18 +157,20 @@ function registerListener(session, options, callback = () => {}) { const message = pupa(errorMessage, {filename: path.basename(filePath)}); callback(new Error(message)); } else if (state === 'completed') { + const savePath = item.getSavePath(); + if (process.platform === 'darwin') { - app.dock.downloadFinished(filePath); + app.dock.downloadFinished(savePath); } if (options.openFolderWhenDone) { - shell.showItemInFolder(filePath); + shell.showItemInFolder(savePath); } if (typeof options.onCompleted === 'function') { options.onCompleted({ fileName: item.getFilename(), - path: item.getSavePath(), + path: savePath, fileSize: item.getReceivedBytes(), mimeType: item.getMimeType(), url: item.getURL()