Skip to content

Commit

Permalink
Ensure libs are properly added to classpath as .jar
Browse files Browse the repository at this point in the history
  • Loading branch information
dscalzi committed Mar 9, 2020
1 parent 5fc6be4 commit 1a2e9f3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app/assets/js/processbuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -601,6 +619,8 @@ class ProcessBuilder {
const finalLibs = {...mojangLibs, ...servLibs}
cpArgs = cpArgs.concat(Object.values(finalLibs))

this._processClassPathList(cpArgs)

return cpArgs
}

Expand Down Expand Up @@ -733,6 +753,7 @@ class ProcessBuilder {
}
return libs
}

}

module.exports = ProcessBuilder

0 comments on commit 1a2e9f3

Please sign in to comment.