diff --git a/util/src/main/kotlin/org/openrs2/util/io/PathExtensions.kt b/util/src/main/kotlin/org/openrs2/util/io/PathExtensions.kt index 0b7ca784..839fb7ed 100644 --- a/util/src/main/kotlin/org/openrs2/util/io/PathExtensions.kt +++ b/util/src/main/kotlin/org/openrs2/util/io/PathExtensions.kt @@ -109,7 +109,9 @@ public inline fun Path.useTempFile( public inline fun Path.atomicWrite(f: (Path) -> T): T { parent.useTempFile(".$fileName", ".tmp") { tempFile -> val result = f(tempFile) + tempFile.fsync() Files.move(tempFile, this, StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING) + parent.fsync() return result } }