mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2024-11-22 12:16:21 +03:00
fix the download of client packages
This commit is contained in:
parent
b850909f5a
commit
001f52e150
4 changed files with 15 additions and 11 deletions
|
@ -51,7 +51,7 @@ launcher.on('error', (e) => console.log(e.toString('utf-8')));
|
|||
|
||||
| Parameter | Type | Description | Required |
|
||||
|--------------------------|----------|-------------------------------------------------------------------------------------------|----------|
|
||||
| `options.clientPackage` | String | Path to the client package zip file. | False |
|
||||
| `options.clientPackage` | String | Path or URL to the client package zip file. | False |
|
||||
| `options.installer` | String | Path to installer being executed. | False |
|
||||
| `options.root` | String | Path where you want the launcher to work in. like `C:/Users/user/AppData/Roaming/.mc`, | True |
|
||||
| `options.os` | String | windows, osx or linux. MCLC with auto determine the OS if this field isn't provided. | False |
|
||||
|
|
|
@ -32,12 +32,14 @@ class MCLCore extends EventEmitter {
|
|||
|
||||
if(this.options.clientPackage) {
|
||||
this.emit('debug', `[MCLC]: Extracting client package to ${this.options.root}`);
|
||||
await packager.extractPackage(this.options.root, this.options.clientPackage);
|
||||
await packager.extractPackage(this);
|
||||
}
|
||||
|
||||
if(this.options.installer) {
|
||||
// So the forge installer can run without breaking :)
|
||||
fs.writeFileSync(path.join(this.options.root, 'launcher_profiles.json'), JSON.stringify({}, null, 4));
|
||||
const profilePath = path.join(this.options.root, 'launcher_profiles.json');
|
||||
if(!fs.existsSync(profilePath))
|
||||
fs.writeFileSync(profilePath, JSON.stringify({}, null, 4));
|
||||
await this.handler.runInstaller(this.options.installer)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
const path = require('path');
|
||||
const zip = require('adm-zip');
|
||||
const shelljs = require('shelljs');
|
||||
|
||||
module.exports.extractPackage = function(root, clientPackage) {
|
||||
module.exports.extractPackage = function(e) {
|
||||
return new Promise(async resolve => {
|
||||
if(clientPackage.startsWith('http')) {
|
||||
await downloadAsync(clientPackage, root, "clientPackage.zip");
|
||||
clientPackage = path.join(root, "clientPackage.zip")
|
||||
if(e.options.clientPackage.startsWith('http')) {
|
||||
await e.handler.downloadAsync(e.options.clientPackage, e.options.root, "clientPackage.zip");
|
||||
e.options.clientPackage = path.join(e.options.root, "clientPackage.zip")
|
||||
}
|
||||
new zip(clientPackage).extractAllTo(root, true);
|
||||
this.client.emit('package-extract', true);
|
||||
new zip(e.options.clientPackage).extractAllTo(e.options.root, true);
|
||||
e.emit('package-extract', true);
|
||||
shelljs.rm(e.options.clientPackage);
|
||||
resolve();
|
||||
});
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "minecraft-launcher-core",
|
||||
"version": "3.7.1",
|
||||
"version": "3.7.2",
|
||||
"description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
|
|
Loading…
Add table
Reference in a new issue