mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FIX] Ошибка на обновление.
This commit is contained in:
parent
22282df126
commit
d210666df2
1 changed files with 10 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
|||
package pro.gravit.launcher.request.update;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -25,6 +27,9 @@ public final class LauncherRequest extends Request<LauncherRequestEvent> impleme
|
|||
public int launcher_type = EXE_BINARY ? 2 : 1;
|
||||
@LauncherAPI
|
||||
public static final Path BINARY_PATH = IOHelper.getCodeSource(Launcher.class);
|
||||
|
||||
@LauncherAPI
|
||||
public static final Path C_BINARY_PATH = BINARY_PATH.getParent().resolve(IOHelper.getFileName(BINARY_PATH) + ".tmp");
|
||||
|
||||
@LauncherAPI
|
||||
public static final boolean EXE_BINARY = IOHelper.hasExtension(BINARY_PATH, "exe");
|
||||
|
@ -52,7 +57,11 @@ public static void update(LauncherRequestEvent result) throws IOException {
|
|||
}*/
|
||||
try {
|
||||
ListDownloader downloader = new ListDownloader();
|
||||
downloader.downloadOne(result.url, BINARY_PATH);
|
||||
downloader.downloadOne(result.url, C_BINARY_PATH);
|
||||
try (InputStream in = IOHelper.newInput(C_BINARY_PATH)) {
|
||||
IOHelper.transfer(in, BINARY_PATH);
|
||||
}
|
||||
Files.deleteIfExists(C_BINARY_PATH);
|
||||
} catch (Throwable e) {
|
||||
LogHelper.error(e);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue