diff --git a/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java b/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java index 6ea83190..6e3cf58b 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java +++ b/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java @@ -3,6 +3,7 @@ import pro.gravit.launcher.client.ClientLauncher; import pro.gravit.launcher.client.ClientModuleManager; import pro.gravit.launcher.client.DirBridge; +import pro.gravit.launcher.utils.DirWatcher; import pro.gravit.utils.helper.EnvHelper; import pro.gravit.utils.helper.IOHelper; import pro.gravit.utils.helper.JVMHelper; @@ -59,6 +60,7 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep JVMHelper.addSystemPropertyToArgs(args, DirBridge.CUSTOMDIR_PROPERTY); JVMHelper.addSystemPropertyToArgs(args, DirBridge.USE_CUSTOMDIR_PROPERTY); JVMHelper.addSystemPropertyToArgs(args, DirBridge.USE_OPTDIR_PROPERTY); + JVMHelper.addSystemPropertyToArgs(args, DirWatcher.IGN_OVERFLOW); if (!noJava9check && !System.getProperty("java.version").startsWith("1.8")) { LogHelper.debug("Found Java 9+ ( %s )", System.getProperty("java.version")); args.add("--add-modules"); diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java index 2905bfd2..8a3fab23 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java @@ -351,6 +351,7 @@ public static Process launch( JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.CUSTOMDIR_PROPERTY); JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.USE_CUSTOMDIR_PROPERTY); JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.USE_OPTDIR_PROPERTY); + JVMHelper.addSystemPropertyToArgs(context.args, DirWatcher.IGN_OVERFLOW); if (JVMHelper.OS_TYPE == OS.MUSTDIE) { if (JVMHelper.OS_VERSION.startsWith("10.")) { LogHelper.debug("MustDie 10 fix is applied"); diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientProcessBuilder.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientProcessBuilder.java index c51b3938..0d579e7e 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientProcessBuilder.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientProcessBuilder.java @@ -5,6 +5,7 @@ import pro.gravit.launcher.hasher.HashedDir; import pro.gravit.launcher.managers.ClientHookManager; import pro.gravit.launcher.profiles.ClientProfile; +import pro.gravit.launcher.utils.DirWatcher; import pro.gravit.utils.helper.EnvHelper; import pro.gravit.utils.helper.IOHelper; import pro.gravit.utils.helper.JVMHelper; @@ -99,6 +100,7 @@ public ClientLauncherContext build() throws IOException { JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.CUSTOMDIR_PROPERTY); JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.USE_CUSTOMDIR_PROPERTY); JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.USE_OPTDIR_PROPERTY); + JVMHelper.addSystemPropertyToArgs(context.args, DirWatcher.IGN_OVERFLOW); if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) { if (JVMHelper.OS_VERSION.startsWith("10.")) { LogHelper.debug("MustDie 10 fix is applied"); diff --git a/Launcher/src/main/java/pro/gravit/launcher/utils/DirWatcher.java b/Launcher/src/main/java/pro/gravit/launcher/utils/DirWatcher.java index ea0edbbf..a9590784 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/utils/DirWatcher.java +++ b/Launcher/src/main/java/pro/gravit/launcher/utils/DirWatcher.java @@ -46,6 +46,9 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) th StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_DELETE }; + public static final String IGN_OVERFLOW = "launcher.dirwatcher.ignoreOverflows"; + private static final boolean PROP_IGN_OVERFLOW = Boolean.getBoolean(IGN_OVERFLOW); + private static void handleError(Throwable e) { LogHelper.error(e); NativeJVMHalt.haltA(-123); @@ -82,7 +85,6 @@ public DirWatcher(Path dir, HashedDir hdir, FileNameMatcher matcher, boolean dig } @Override - public void close() throws IOException { service.close(); } @@ -92,7 +94,7 @@ private void processKey(WatchKey key) throws IOException { for (WatchEvent event : key.pollEvents()) { Kind kind = event.kind(); if (kind.equals(StandardWatchEventKinds.OVERFLOW)) { - if (Boolean.getBoolean("launcher.dirwatcher.ignoreOverflows")) + if (PROP_IGN_OVERFLOW) continue; // Sometimes it's better to ignore than interrupt fair playing throw new IOException("Overflow"); }