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:
parent
cc25f2c2e0
commit
a3c9130d7a
@ -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
|
||||
}
|
@ -2,6 +2,20 @@ var $ = require('jQuery');
|
||||
const remote = require('electron').remote
|
||||
const shell = require('electron').shell
|
||||
const path = require('path')
|
||||
const os = require('os');
|
||||
const ag = require(path.join(__dirname, 'assets', 'js', 'assetguard.js'))
|
||||
|
||||
function timestamp(){
|
||||
let date = new Date();
|
||||
const month = date.getMonth() < 9 ? '0'.concat((date.getMonth()+1)) : date.getMonth()
|
||||
const day = date.getDate() < 10 ? '0'.concat(date.getDate()) : date.getDate();
|
||||
let hour = date.getHours() > 12 ? date.getHours() - 12 : date.getHours();
|
||||
hour = hour < 10 ? '0'.concat(hour) : hour
|
||||
const min = date.getMinutes() < 10 ? '0'.concat(date.getMinutes()) : date.getMinutes();
|
||||
const sec = date.getSeconds() < 10 ? '0'.concat(date.getSeconds()) : date.getSeconds();
|
||||
|
||||
return os.EOL + '[' + month + '/' + day + '/' + date.getFullYear() + ' ' + hour + ':' + min + ':' + sec + ']'
|
||||
}
|
||||
|
||||
$(document).on('ready', function(){
|
||||
$(".toggle-btn input[type=radio]").addClass("visuallyhidden");
|
||||
@ -12,27 +26,25 @@ $(document).on('ready', function(){
|
||||
$(this).parent().toggleClass("success")
|
||||
}
|
||||
})
|
||||
process.stdout.on('data', (data) => {
|
||||
$('#launcher-log').append(data.toString('utf8'))
|
||||
//console.log('minecraft:', data.toString('utf8'))
|
||||
})
|
||||
process.stderr.on('data', (data) => {
|
||||
$('#launcher-log').append(data.toString('utf8'))
|
||||
//console.log('minecraft:', data.toString('utf8'))
|
||||
})
|
||||
/*console.log = function(){
|
||||
$('#launcher-log').append(timestamp() + ' [Log] - ' + Array.prototype.slice.call(arguments).join(' '))
|
||||
}
|
||||
console.error = function(){
|
||||
$('#launcher-log').append(timestamp() + ' [Error] - ' + Array.prototype.slice.call(arguments).join(' '))
|
||||
}
|
||||
console.log('test')
|
||||
console.debug('test')
|
||||
//console.debug('test')*/
|
||||
})
|
||||
|
||||
/* Open web links in the user's default browser. */
|
||||
$(document).on('click', 'a[href^="http"]', function(event) {
|
||||
event.preventDefault();
|
||||
testdownloads()
|
||||
//shell.openExternal(this.href)
|
||||
//ag._extractPackXZ(path.join(__dirname, '..', 'mcfiles', 'scala-continuations-library_2.11-1.0.2.jar.pack.xz'))
|
||||
//testdownloads()
|
||||
shell.openExternal(this.href)
|
||||
});
|
||||
|
||||
testdownloads = async function(){
|
||||
const ag = require(path.join(__dirname, 'assets', 'js', 'assetguard.js'))
|
||||
const lp = require(path.join(__dirname, 'assets', 'js', 'launchprocess.js'))
|
||||
const basePath = path.join(__dirname, '..', 'mcfiles')
|
||||
let versionData = await ag.loadVersionData('1.11.2', basePath)
|
||||
|
BIN
app/assets/libraries/java/PackXZExtract.jar
Normal file
BIN
app/assets/libraries/java/PackXZExtract.jar
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user