mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX] Фиксы работы загрузки своей джавы
This commit is contained in:
parent
642038576a
commit
f74b5cd1d9
4 changed files with 19 additions and 5 deletions
|
@ -62,9 +62,10 @@ public void start(String... args) throws Throwable {
|
|||
Launcher.modulesManager = new ClientModuleManager(this);
|
||||
LauncherConfig.getAutogenConfig().initModules();
|
||||
Launcher.modulesManager.preInitModules();
|
||||
LauncherGuardManager.initGuard(false);
|
||||
if (runtimeProvider == null) runtimeProvider = new JSRuntimeProvider();
|
||||
runtimeProvider.init(false);
|
||||
runtimeProvider.preLoad();
|
||||
LauncherGuardManager.initGuard(false);
|
||||
Objects.requireNonNull(args, "args");
|
||||
if (started.getAndSet(true))
|
||||
throw new IllegalStateException("Launcher has been already started");
|
||||
|
|
|
@ -469,7 +469,6 @@ public static void main(String... args) throws Throwable {
|
|||
LauncherConfig.getAutogenConfig().initModules(); //INIT
|
||||
initGson();
|
||||
Launcher.modulesManager.preInitModules();
|
||||
LauncherGuardManager.initGuard(true);
|
||||
checkJVMBitsAndVersion();
|
||||
JVMHelper.verifySystemProperties(ClientLauncher.class, true);
|
||||
EnvHelper.checkDangerousParams();
|
||||
|
@ -478,6 +477,7 @@ public static void main(String... args) throws Throwable {
|
|||
if (engine.runtimeProvider == null) engine.runtimeProvider = new JSRuntimeProvider();
|
||||
engine.runtimeProvider.init(true);
|
||||
engine.runtimeProvider.preLoad();
|
||||
LauncherGuardManager.initGuard(true);
|
||||
// Read and delete params file
|
||||
LogHelper.debug("Reading ClientLauncher params");
|
||||
Params params;
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
import ru.gravit.launcher.client.DirBridge;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
import ru.gravit.utils.helper.JVMHelper;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
import ru.gravit.utils.helper.UnpackHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
|
@ -23,6 +26,10 @@ public Path getJavaBinPath() {
|
|||
|
||||
@Override
|
||||
public void init(boolean clientInstance) {
|
||||
|
||||
try {
|
||||
UnpackHelper.unpack(IOHelper.getResourceURL(JVMHelper.JVM_BITS == 64 ? "wrapper64.exe" : "wrapper32.exe"),DirBridge.getGuardDir());
|
||||
} catch (IOException e) {
|
||||
throw new SecurityException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
public class JSRuntimeProvider implements RuntimeProvider {
|
||||
|
||||
private final ScriptEngine engine = CommonHelper.newScriptEngine();
|
||||
private boolean isPreLoaded = false;
|
||||
|
||||
@LauncherAPI
|
||||
public static void addLauncherClassBindings(Map<String, Object> bindings) {
|
||||
|
@ -145,6 +146,7 @@ private void setScriptBindings() {
|
|||
|
||||
@Override
|
||||
public void run(String[] args) throws ScriptException, NoSuchMethodException, IOException {
|
||||
preLoad();
|
||||
loadScript(Launcher.INIT_SCRIPT_FILE);
|
||||
LogHelper.info("Invoking start() function");
|
||||
Launcher.modulesManager.postInitModules();
|
||||
|
@ -154,8 +156,12 @@ public void run(String[] args) throws ScriptException, NoSuchMethodException, IO
|
|||
|
||||
@Override
|
||||
public void preLoad() throws IOException, ScriptException {
|
||||
loadScript(Launcher.API_SCRIPT_FILE);
|
||||
loadScript(Launcher.CONFIG_SCRIPT_FILE);
|
||||
if(!isPreLoaded)
|
||||
{
|
||||
loadScript(Launcher.API_SCRIPT_FILE);
|
||||
loadScript(Launcher.CONFIG_SCRIPT_FILE);
|
||||
isPreLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue