From f1a1af1e3c2121c552aaee9b4586204969033eca Mon Sep 17 00:00:00 2001 From: coder_Q <55419399+PlayGuitar-CoderQ@users.noreply.github.com> Date: Fri, 8 Apr 2022 19:26:53 +0800 Subject: [PATCH] Use the correct path (#149) Co-authored-by: Sindre Sorhus --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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()