mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FEATURE] DirWatcher для params.javaHDir
This commit is contained in:
parent
c969b16391
commit
1fbad1cfa0
2 changed files with 18 additions and 3 deletions
|
@ -50,6 +50,8 @@ 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);
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -150,9 +150,15 @@ public void runWriteParams(SocketAddress address) throws IOException {
|
|||
output.writeByteArray(serializedMainParams, 0);
|
||||
params.clientHDir.write(output);
|
||||
params.assetHDir.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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue