@@ -6,7 +6,6 @@ import java.io.IOException
66import java.nio.file.Files
77import java.nio.file.StandardCopyOption
88import java.util.logging.Logger
9- import kotlin.system.exitProcess
109
1110/* *
1211 * Handles automatic updates for the Lambda-Loader itself.
@@ -108,7 +107,7 @@ class LoaderUpdater(
108107 }
109108
110109 return try {
111- logger.info(" ═══════════════════════════════════════════════════════════ " )
110+ logger.info(" ============================================================ " )
112111 logger.info(" Applying loader update: ${updateInfo.currentVersion} -> ${updateInfo.latestVersion} " )
113112 logger.info(" Current JAR: ${currentJar.absolutePath} " )
114113 logger.info(" Update JAR: ${updateInfo.updateFile.absolutePath} " )
@@ -124,16 +123,12 @@ class LoaderUpdater(
124123
125124 if (ConfigManager .config.debug) logger.info(" Replacing loader JAR..." )
126125
127- Files .copy(
128- updateInfo.updateFile.toPath(),
129- currentJar.toPath(),
130- StandardCopyOption .REPLACE_EXISTING
131- )
126+ currentJar.writeBytes(updateInfo.updateFile.readBytes())
132127
133128 backupFile.delete()
134129
135130 logger.info(" Loader update applied successfully!" )
136- logger.info(" ═══════════════════════════════════════════════════════════ " )
131+ logger.info(" ============================================================ " )
137132
138133 true
139134 } catch (e: IOException ) {
@@ -159,12 +154,7 @@ class LoaderUpdater(
159154 return try {
160155 logger.info(" Restoring loader from backup: ${backupFile.absolutePath} " )
161156
162- Files .copy(
163- backupFile.toPath(),
164- currentJar.toPath(),
165- StandardCopyOption .REPLACE_EXISTING
166- )
167-
157+ currentJar.writeBytes(backupFile.readBytes())
168158 backupFile.delete()
169159
170160 logger.info(" Loader restored from backup successfully!" )
0 commit comments