Added functionality to extract .pack.xz files. The npm modules available to do this were a mess, being either outdated or refusing to build on windows. In order to achieve this, I wrote up a small java library which will extract these files. We simply pass the files we want to extract to the command line using a corresponding argument and it does the rest. This should be no issue as we will always have a JRE present on this launcher, whether that be bundled or already installed.

This commit is contained in:
Daniel Scalzi
2017-05-18 01:49:28 -04:00
parent cc25f2c2e0
commit a3c9130d7a
3 changed files with 43 additions and 14 deletions

View File

@@ -29,7 +29,8 @@ const mkpath = require('mkdirp');
const async = require('async')
const crypto = require('crypto')
const AdmZip = require('adm-zip')
const EventEmitter = require('events');
const child_process = require('child_process')
const EventEmitter = require('events')
const {remote} = require('electron')
// Classes
@@ -269,6 +270,21 @@ function _validateForgeJar(buf, checksums){
return true
}
function _extractPackXZ(filePath){
const libPath = path.join(__dirname, '..', 'libraries', 'java', 'PackXZExtract.jar')
console.log(libPath)
const child = child_process.spawn('C:\\Program Files\\Java\\jre1.8.0_131\\bin\\javaw.exe', ['-jar', libPath, '-packxz', filePath])
child.stdout.on('data', (data) => {
console.log('minecraft:', data.toString('utf8'))
})
child.stderr.on('data', (data) => {
console.log('minecraft:', data.toString('utf8'))
})
child.on('close', (code, signal) => {
console.log('exited with code', code)
})
}
/**
* Initiate an async download process for an AssetGuard DLTracker.
*
@@ -594,5 +610,6 @@ module.exports = {
processDlQueues,
instance,
Asset,
Library
Library,
_extractPackXZ
}