From c965a6b5196d5957303edfb1a3c5ed81df5b9249 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 17 Sep 2023 17:48:40 +0200 Subject: fixed combination of opengl and windows together don't like file replace operation with standard java library --- src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt index 23e9b6261..a1586bc91 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt @@ -21,6 +21,8 @@ import io.github.moulberry.moulconfig.processor.MoulConfigProcessor import net.minecraft.item.ItemStack import java.io.* import java.nio.charset.StandardCharsets +import java.nio.file.Files +import java.nio.file.StandardCopyOption import java.util.* import kotlin.concurrent.fixedRateTimer @@ -83,7 +85,6 @@ class ConfigManager { lateinit var features: Features lateinit var sackData: SackData - private set private val logger = LorenzLogger("config_manager") @@ -211,7 +212,12 @@ class ConfigManager { writer.write(gson.toJson(SkyHanniMod.feature)) } // Perform move — which is atomic, unlike writing — after writing is done. - unit.renameTo(file) + Files.move( + unit.toPath(), + file.toPath(), + StandardCopyOption.REPLACE_EXISTING, + StandardCopyOption.ATOMIC_MOVE + ) } catch (e: IOException) { logger.log("Could not save config file to $file") e.printStackTrace() -- cgit