From d08cfbf248c5205628da7f24517f10a2085a0581 Mon Sep 17 00:00:00 2001 From: Daniel Scalzi Date: Sat, 28 Apr 2018 20:52:13 -0400 Subject: [PATCH] Change library extraction to be queue based to ensure it completes. --- app/assets/js/assetexec.js | 4 ++++ app/assets/js/assetguard.js | 14 ++++++++------ app/assets/js/scripts/landing.js | 5 +++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/assets/js/assetexec.js b/app/assets/js/assetexec.js index 7a75d90..90c546a 100644 --- a/app/assets/js/assetexec.js +++ b/app/assets/js/assetexec.js @@ -14,6 +14,10 @@ tracker.on('totaldlprogress', (data) => { process.send({task: 0, total: data.total, value: data.acc, percent: parseInt((data.acc/data.total)*100), content: 'dl'}) }) +tracker.on('extracting', () => { + process.send({task: 0.7, content: 'dl'}) +}) + tracker.on('dlcomplete', () => { process.send({task: 1, content: 'dl'}) }) diff --git a/app/assets/js/assetguard.js b/app/assets/js/assetguard.js index 97eeda5..10c4fed 100644 --- a/app/assets/js/assetguard.js +++ b/app/assets/js/assetguard.js @@ -191,6 +191,7 @@ class AssetGuard extends EventEmitter { this.files = new DLTracker([], 0) this.forge = new DLTracker([], 0) this.java = new DLTracker([], 0) + this.extractQueue = [] this.basePath = basePath this.javaexec = javaexec } @@ -1284,12 +1285,10 @@ class AssetGuard extends EventEmitter { } self.forge = self._parseDistroModules(serv.modules, serv.mc_version) - //Correct our workaround here. + // Correct our workaround here. let decompressqueue = self.forge.callback + self.extractQueue = decompressqueue self.forge.callback = function(asset, self){ - if(asset.to.toLowerCase().endsWith('.pack.xz')){ - AssetGuard._extractPackXZ([asset.to], self.javaexec) - } if(asset.type === 'forge-hosted' || asset.type === 'forge'){ AssetGuard._finalizeForgeAsset(asset, self.basePath) } @@ -1315,7 +1314,6 @@ class AssetGuard extends EventEmitter { _parseDistroModules(modules, version){ let alist = [] let asize = 0; - //This may be removed soon, considering the most efficient way to extract. let decompressqueue = [] for(let i=0; i { + self.extractQueue = [] + self.emit('dlcomplete') + }) } }) return true diff --git a/app/assets/js/scripts/landing.js b/app/assets/js/scripts/landing.js index 719e587..599fedc 100644 --- a/app/assets/js/scripts/landing.js +++ b/app/assets/js/scripts/landing.js @@ -440,6 +440,11 @@ function dlAsync(login = true){ setDownloadPercentage(m.value, m.total, m.percent) + } else if(m.task === 0.7){ + + // Download done, extracting. + setLaunchDetails('Extracting libraries..') + } else if(m.task === 1){ // Download will be at 100%, remove the loading from the OS progress bar.