mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-04-11 14:19:38 +00:00
Fixed download bugs
This commit is contained in:
@@ -119,7 +119,7 @@ export class ChartDownload {
|
||||
|
||||
// DOWNLOAD FILES
|
||||
for (let i = 0; i < this.files.length; i++) {
|
||||
const downloader = new FileDownloader(this.files[i].webContentLink, chartPath)
|
||||
const downloader = new FileDownloader(this.files[i].webContentLink, join(chartPath, this.files[i].name))
|
||||
this.cancelFn = () => downloader.cancelDownload()
|
||||
|
||||
const downloadComplete = this.addDownloadEventListeners(downloader, i)
|
||||
|
||||
@@ -29,7 +29,7 @@ class DownloadHandler implements IPCEmitHandler<'download'> {
|
||||
}
|
||||
}
|
||||
|
||||
private retryDownload(data: Download) {
|
||||
private retryDownload(data: Download) { // TODO: cause this to send a GUI update that says waiting for download to finish...
|
||||
const index = this.retryWaiting.findIndex(download => download.versionID == data.versionID)
|
||||
if (index != -1) {
|
||||
const retryDownload = this.retryWaiting.splice(index, 1)[0]
|
||||
@@ -43,7 +43,7 @@ class DownloadHandler implements IPCEmitHandler<'download'> {
|
||||
}
|
||||
|
||||
private cancelDownload(data: Download) {
|
||||
if (this.currentDownload.versionID == data.versionID) {
|
||||
if (this.currentDownload?.versionID == data.versionID) {
|
||||
this.currentDownload.cancel()
|
||||
this.currentDownload = undefined
|
||||
this.startNextDownload()
|
||||
|
||||
@@ -112,7 +112,7 @@ export class FileExtractor {
|
||||
const stream = node7z.extractFull(fullPath, this.sourceFolder, { $progress: true, $bin: zipBin.path7za })
|
||||
|
||||
stream.on('progress', this.cancelable((progress: { percent: number; fileCount: number }) => {
|
||||
this.callbacks.extractProgress(progress.percent, progress.fileCount)
|
||||
this.callbacks.extractProgress(progress.percent, isNaN(progress.fileCount) ? 0 : progress.fileCount)
|
||||
}))
|
||||
|
||||
let extractErrorOccured = false
|
||||
|
||||
Reference in New Issue
Block a user