mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-22 03:32:12 -08:00
Ensure libs are properly added to classpath as .jar
This commit is contained in:
parent
5fc6be444a
commit
1a2e9f3be4
@ -569,6 +569,24 @@ class ProcessBuilder {
|
||||
return mcArgs
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the classpath entries all point to jar files.
|
||||
*
|
||||
* @param {Array.<String>} list Array of classpath entries.
|
||||
*/
|
||||
_processClassPathList(list) {
|
||||
|
||||
const ext = '.jar'
|
||||
const extLen = ext.length
|
||||
for(let i=0; i<list.length; i++) {
|
||||
const extIndex = list[i].indexOf(ext)
|
||||
if(extIndex > -1 && extIndex !== list[i].length - extLen) {
|
||||
list[i] = list[i].substring(0, extIndex + extLen)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the full classpath argument list for this process. This method will resolve all Mojang-declared
|
||||
* libraries as well as the libraries declared by the server. Since mods are permitted to declare libraries,
|
||||
@ -601,6 +619,8 @@ class ProcessBuilder {
|
||||
const finalLibs = {...mojangLibs, ...servLibs}
|
||||
cpArgs = cpArgs.concat(Object.values(finalLibs))
|
||||
|
||||
this._processClassPathList(cpArgs)
|
||||
|
||||
return cpArgs
|
||||
}
|
||||
|
||||
@ -733,6 +753,7 @@ class ProcessBuilder {
|
||||
}
|
||||
return libs
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = ProcessBuilder
|
Loading…
Reference in New Issue
Block a user