From 1a2e9f3be4575ba87b29e9f07463ad2b6ec24447 Mon Sep 17 00:00:00 2001 From: Daniel Scalzi Date: Sun, 8 Mar 2020 21:10:43 -0400 Subject: [PATCH] Ensure libs are properly added to classpath as .jar --- app/assets/js/processbuilder.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/assets/js/processbuilder.js b/app/assets/js/processbuilder.js index 0f1ef8dd..173501a4 100644 --- a/app/assets/js/processbuilder.js +++ b/app/assets/js/processbuilder.js @@ -569,6 +569,24 @@ class ProcessBuilder { return mcArgs } + /** + * Ensure that the classpath entries all point to jar files. + * + * @param {Array.} list Array of classpath entries. + */ + _processClassPathList(list) { + + const ext = '.jar' + const extLen = ext.length + for(let i=0; i -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 \ No newline at end of file