Skip to content

Commit

Permalink
fix(UpdateChecker): Use OS move function instead of copying
Browse files Browse the repository at this point in the history
  • Loading branch information
My-Name-Is-Jeff committed Feb 11, 2025
1 parent d4bc147 commit e9ef6ff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/kotlin/gg/skytils/skytilsmod/core/UpdateChecker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion
import java.io.File
import java.nio.file.Files
import java.nio.file.StandardCopyOption

object UpdateChecker {
val updateGetter = UpdateGetter()
Expand Down Expand Up @@ -73,9 +75,7 @@ object UpdateChecker {
oldJar.parent,
"${if (oldJar.name.startsWith("!")) "!" else ""}${nameNoExtension}${if (oldJar.endsWith(".temp.jar") && newExtension == oldJar.extension) ".temp.jar" else ".$newExtension"}"
)
newLocation.createNewFile()
newJar.copyTo(newLocation, true)
newJar.delete()
Files.move(newJar.toPath(), newLocation.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE)
if (oldJar.delete()) {
println("successfully deleted the files. skipping install tasks")
return@Thread
Expand Down

0 comments on commit e9ef6ff

Please sign in to comment.