From 59e3a9b079b8abd40c18cc07b85a8cd66c9ff389 Mon Sep 17 00:00:00 2001 From: TheCherry Date: Mon, 16 Mar 2020 16:43:20 +0100 Subject: [PATCH] fix fuer classpath --- app/assets/js/processbuilder.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/assets/js/processbuilder.js b/app/assets/js/processbuilder.js index 1f54ee0a6a..57de9a1a59 100644 --- a/app/assets/js/processbuilder.js +++ b/app/assets/js/processbuilder.js @@ -570,6 +570,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 < 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, @@ -602,6 +620,8 @@ class ProcessBuilder { const finalLibs = {...mojangLibs, ...servLibs} cpArgs = cpArgs.concat(Object.values(finalLibs)) + this._processClassPathList(cpArgs) + return cpArgs }