Fix clean up, remove options.forge.path

This commit is contained in:
Pierce 2019-06-25 11:01:35 -04:00
parent c62a3b293f
commit fafd82856f
3 changed files with 12 additions and 12 deletions

View file

@ -261,7 +261,7 @@ class Handler {
await this.downloadAsync(url, jarPath, name); await this.downloadAsync(url, jarPath, name);
} }
} }
libs.push(`${jarPath}/${name}`); libs.push(`${jarPath}${path.sep}${name}`);
})); }));
} }
@ -290,14 +290,15 @@ class Handler {
} }
static cleanUp(array) { static cleanUp(array) {
return new Promise(resolve => {
const newArray = []; const newArray = [];
for(let argument in array) { for(let classPath in array) {
if(newArray.includes(array[argument])) continue; if(newArray.includes(array[classPath])) continue;
newArray.push(array[argument]); newArray.push(array[classPath]);
} }
resolve(newArray);
return newArray; })
} }
getLaunchOptions(modification) { getLaunchOptions(modification) {

View file

@ -65,20 +65,19 @@ class MCLCore extends EventEmitter {
jvm.push(await this.handler.getJVM()); jvm.push(await this.handler.getJVM());
if(this.options.customArgs) jvm = jvm.concat(this.options.customArgs); if(this.options.customArgs) jvm = jvm.concat(this.options.customArgs);
const classes = await this.handler.getClasses(); const classes = await handler.cleanUp(await this.handler.getClasses());
let classPaths = ['-cp']; let classPaths = ['-cp'];
const separator = this.handler.getOS() === "windows" ? ";" : ":"; const separator = this.handler.getOS() === "windows" ? ";" : ":";
this.emit('debug', `[MCLC]: Using ${separator} to separate class paths`); this.emit('debug', `[MCLC]: Using ${separator} to separate class paths`);
if(forge) { if(forge) {
this.emit('debug', '[MCLC]: Setting Forge class paths'); this.emit('debug', '[MCLC]: Setting Forge class paths');
classPaths.push(`${this.options.forge.path || this.options.forge}${separator}${forge.paths.join(separator)}${separator}${classes.join(separator)}${separator}${mcPath}`); classPaths.push(`${path.resolve(this.options.forge)}${separator}${forge.paths.join(separator)}${separator}${classes.join(separator)}${separator}${mcPath}`);
classPaths.push(forge.forge.mainClass) classPaths.push(forge.forge.mainClass)
} else { } else {
const file = custom || versionFile; const file = custom || versionFile;
classPaths.push(`${mcPath}${separator}${classes.join(separator)}`); classPaths.push(`${mcPath}${separator}${classes.join(separator)}`);
classPaths.push(file.mainClass); classPaths.push(file.mainClass);
} }
classPaths = await handler.cleanUp(classPaths);
// Download version's assets // Download version's assets
this.emit('debug', '[MCLC]: Attempting to download assets'); this.emit('debug', '[MCLC]: Attempting to download assets');

View file

@ -1,6 +1,6 @@
{ {
"name": "minecraft-launcher-core", "name": "minecraft-launcher-core",
"version": "3.5.2", "version": "3.5.3",
"description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS", "description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {