diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-17 17:48:40 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-17 17:48:40 +0200 |
commit | c965a6b5196d5957303edfb1a3c5ed81df5b9249 (patch) | |
tree | 41b66909c4f078ae493a70e1cb264872cfca25e8 /src/main | |
parent | 52c6bc751f4d4f9112531b68998eb33d466a328d (diff) | |
download | skyhanni-c965a6b5196d5957303edfb1a3c5ed81df5b9249.tar.gz skyhanni-c965a6b5196d5957303edfb1a3c5ed81df5b9249.tar.bz2 skyhanni-c965a6b5196d5957303edfb1a3c5ed81df5b9249.zip |
fixed combination of opengl and windows together don't like file replace operation with standard java library
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt | 10 |
1 files changed, 8 insertions, 2 deletions
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() |