From ae994ebb4f9fbb6c48aa447e060460e21f3f1e35 Mon Sep 17 00:00:00 2001 From: Gravita Date: Fri, 9 Dec 2022 21:23:18 +0700 Subject: [PATCH] [FIX] More safe save config and 5.3.3 --- .../pro/gravit/launchserver/LaunchServerStarter.java | 12 +++++++++--- .../src/main/java/pro/gravit/utils/Version.java | 2 +- build.gradle | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java index d4208a21..59890706 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServerStarter.java @@ -149,11 +149,14 @@ public void writeConfig(LaunchServerConfig config) throws IOException { try (Writer writer = IOHelper.newWriter(output)) { if (Launcher.gsonManager.configGson != null) { Launcher.gsonManager.configGson.toJson(config, writer); - IOHelper.write(configFile, output.toByteArray()); } else { - logger.error("Error writing LaunchServer runtime config file. Gson is null"); + logger.error("Error writing LaunchServer config file. Gson is null"); } } + byte[] bytes = output.toByteArray(); + if(bytes.length > 0) { + IOHelper.write(configFile, bytes); + } } @Override @@ -162,11 +165,14 @@ public void writeRuntimeConfig(LaunchServerRuntimeConfig config) throws IOExcept try (Writer writer = IOHelper.newWriter(output)) { if (Launcher.gsonManager.configGson != null) { Launcher.gsonManager.configGson.toJson(config, writer); - IOHelper.write(runtimeConfigFile, output.toByteArray()); } else { logger.error("Error writing LaunchServer runtime config file. Gson is null"); } } + byte[] bytes = output.toByteArray(); + if(bytes.length > 0) { + IOHelper.write(runtimeConfigFile, bytes); + } } }; LaunchServer.LaunchServerDirectories directories = new LaunchServer.LaunchServerDirectories(); diff --git a/LauncherCore/src/main/java/pro/gravit/utils/Version.java b/LauncherCore/src/main/java/pro/gravit/utils/Version.java index 34cf2ce5..99062749 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/Version.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/Version.java @@ -6,7 +6,7 @@ public final class Version implements Comparable { public static final int MAJOR = 5; public static final int MINOR = 3; - public static final int PATCH = 2; + public static final int PATCH = 3; public static final int BUILD = 1; public static final Version.Type RELEASE = Type.STABLE; public final int major; diff --git a/build.gradle b/build.gradle index 1b8f9b54..5156e367 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ id 'org.openjfx.javafxplugin' version '0.0.10' apply false } group = 'pro.gravit.launcher' -version = '5.3.2' +version = '5.3.3' apply from: 'props.gradle'