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.
This commit is contained in:
parent
2068b7470b
commit
df1228ffa6
@ -45,7 +45,10 @@ const parseWindowsInstallerProgress = (output) => {
|
|||||||
const copyFile = line.match(/^installer:COPY_FILE:(\d+):(.*)$/)
|
const copyFile = line.match(/^installer:COPY_FILE:(\d+):(.*)$/)
|
||||||
if (copyFile) {
|
if (copyFile) {
|
||||||
const fileBytes = Number.parseInt(copyFile[1], 10)
|
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)) {
|
if (Number.isFinite(fileBytes)) {
|
||||||
copiedBytes += fileBytes
|
copiedBytes += fileBytes
|
||||||
@ -57,8 +60,8 @@ const parseWindowsInstallerProgress = (output) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (relativePath) {
|
if (fileName) {
|
||||||
message = `Copying ${relativePath} (${formatBytes(fileBytes)})`
|
message = `Copying ${fileName} (${formatBytes(fileBytes)})`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user