From df1228ffa6c0c0d90e019320c411df0151dc03e8 Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Sun, 9 Aug 2026 13:40:02 +0100 Subject: [PATCH] Refactor Windows installer progress parsing to improve file name handling - Updated the parsing logic in `parseWindowsInstallerProgress` to extract the file name from the copy file path, ensuring only the file name is displayed in progress messages. - Enhanced readability by renaming the variable from `relativePath` to `fileName` and added logic to handle paths correctly. --- src/desktop/winappupdate.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/desktop/winappupdate.js b/src/desktop/winappupdate.js index 295ffff..d62da27 100644 --- a/src/desktop/winappupdate.js +++ b/src/desktop/winappupdate.js @@ -45,7 +45,10 @@ const parseWindowsInstallerProgress = (output) => { const copyFile = line.match(/^installer:COPY_FILE:(\d+):(.*)$/) if (copyFile) { const fileBytes = Number.parseInt(copyFile[1], 10) - const relativePath = copyFile[2].trim() + var fileName = copyFile[2].trim() + if (fileName.includes('\\')) { + fileName = fileName.split('\\').pop() + } if (Number.isFinite(fileBytes)) { copiedBytes += fileBytes @@ -57,8 +60,8 @@ const parseWindowsInstallerProgress = (output) => { } } - if (relativePath) { - message = `Copying ${relativePath} (${formatBytes(fileBytes)})` + if (fileName) { + message = `Copying ${fileName} (${formatBytes(fileBytes)})` } } } else if (