From 3374b068824d160d259f24a676cd34153b9961b2 Mon Sep 17 00:00:00 2001 From: zaxar163 Date: Thu, 3 Jan 2019 17:27:26 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20restart.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/ru/gravit/launchserver/LaunchServer.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index 6810a7e8..bf120793 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -2,9 +2,9 @@ import java.io.BufferedReader; import java.io.BufferedWriter; +import java.io.File; import java.io.IOException; import java.lang.ProcessBuilder.Redirect; -import java.lang.management.ManagementFactory; import java.net.InetSocketAddress; import java.net.MalformedURLException; import java.net.SocketAddress; @@ -12,7 +12,6 @@ import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.security.KeyPair; @@ -75,7 +74,6 @@ import ru.gravit.launchserver.texture.RequestTextureProvider; import ru.gravit.launchserver.texture.TextureProvider; import ru.gravit.utils.helper.CommonHelper; -import ru.gravit.utils.helper.EnvHelper; import ru.gravit.utils.helper.IOHelper; import ru.gravit.utils.helper.JVMHelper; import ru.gravit.utils.helper.LogHelper; @@ -142,6 +140,8 @@ public static final class Config { public boolean isWarningMissArchJava; + public String startScript; + public String getAddress() { return address; @@ -564,6 +564,7 @@ private void generateConfigIfNotExists() throws IOException { newConfig.launch4j.productVer = newConfig.launch4j.fileVer; newConfig.buildPostTransform = new PostBuildTransformConf(); newConfig.env = LauncherConfig.LauncherEnvironment.STD; + newConfig.startScript = "." + File.separator + "start.sh"; newConfig.authHandler = new MemoryAuthHandler(); newConfig.hwidHandler = new AcceptHWIDHandler(); @@ -688,10 +689,7 @@ public void syncUpdatesDir(Collection dirs) throws IOException { public void restart() { ProcessBuilder builder = new ProcessBuilder(); List args = new ArrayList<>(); - args.add(IOHelper.resolveJavaBin(Paths.get(System.getProperty("java.home"))).toString()); - args.addAll(ManagementFactory.getRuntimeMXBean().getInputArguments()); - args.addAll(args); - EnvHelper.addEnv(builder); + args.add(config.startScript); builder.directory(this.dir.toFile()); builder.inheritIO(); builder.redirectErrorStream(true); @@ -704,7 +702,7 @@ public void restart() { } public void fullyRestart() { - server.restart(); + restart(); JVMHelper.RUNTIME.exit(0); } }