diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java index b61d9d89..cf1ebcc0 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherEntryPoint.java @@ -50,7 +50,9 @@ private static ClientLauncherProcess.ClientParams readParams(SocketAddress addre ClientLauncherProcess.ClientParams params = Launcher.gsonManager.gson.fromJson(new String(serialized, IOHelper.UNICODE_CHARSET), ClientLauncherProcess.ClientParams.class); params.clientHDir = new HashedDir(input); params.assetHDir = new HashedDir(input); - params.javaHDir = new HashedDir(input); + boolean isNeedReadJavaDir = input.readBoolean(); + if(isNeedReadJavaDir) + params.javaHDir = new HashedDir(input); return params; } } @@ -133,8 +135,10 @@ public static void main(String[] args) throws Throwable { LogHelper.debug("Starting JVM and client WatchService"); FileNameMatcher assetMatcher = profile.getAssetUpdateMatcher(); FileNameMatcher clientMatcher = profile.getClientUpdateMatcher(); + Path javaDir = Paths.get(System.getProperty("java.home")); try (DirWatcher assetWatcher = new DirWatcher(assetDir, params.assetHDir, assetMatcher, digest); - DirWatcher clientWatcher = new DirWatcher(clientDir, params.clientHDir, clientMatcher, digest)) { + DirWatcher clientWatcher = new DirWatcher(clientDir, params.clientHDir, clientMatcher, digest); + DirWatcher javaWatcher = params.javaHDir == null ? null : new DirWatcher(javaDir, params.javaHDir, null, digest)) { // Verify current state of all dirs //verifyHDir(IOHelper.JVM_DIR, jvmHDir.object, null, digest); //for (OptionalFile s : Launcher.profile.getOptional()) { @@ -145,8 +149,13 @@ public static void main(String[] args) throws Throwable { // Start WatchService, and only then client CommonHelper.newThread("Asset Directory Watcher", true, assetWatcher).start(); CommonHelper.newThread("Client Directory Watcher", true, clientWatcher).start(); + if(javaWatcher != null) + CommonHelper.newThread("Java Directory Watcher", true, clientWatcher).start(); verifyHDir(assetDir, params.assetHDir, assetMatcher, digest); verifyHDir(clientDir, params.clientHDir, clientMatcher, digest); + if(javaWatcher != null) + verifyHDir(javaDir, params.javaHDir, null, digest); + if(params.javaHDir != null) LauncherEngine.modulesManager.invokeEvent(new ClientProcessLaunchEvent(engine, params)); launch(profile, params); } diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherProcess.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherProcess.java index 80fe1dc3..2cb28b4a 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherProcess.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncherProcess.java @@ -150,7 +150,13 @@ public void runWriteParams(SocketAddress address) throws IOException { output.writeByteArray(serializedMainParams, 0); params.clientHDir.write(output); params.assetHDir.write(output); - params.javaHDir.write(output); + if(params.javaHDir == null || params.javaHDir == params.assetHDir) { //TODO: OLD RUNTIME USE params.assetHDir AS NULL IN java.javaHDir + output.writeBoolean(false); + } + else { + output.writeBoolean(true); + params.javaHDir.write(output); + } } } LauncherEngine.modulesManager.invokeEvent(new ClientProcessBuilderParamsWrittedEvent(this));