commit
4ca4f7ad3a
Binary file not shown.
Binary file not shown.
|
@ -49,8 +49,9 @@ public class updater implements Runnable{
|
||||||
apiOutput = ina.readLine();
|
apiOutput = ina.readLine();
|
||||||
ina.close();
|
ina.close();
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
|
Platform.runLater(() -> {
|
||||||
mainWindowController.showErrorMsg(mainWindowController.errorUpdateV, e1);
|
mainWindowController.showErrorMsg(mainWindowController.errorUpdateV, e1);
|
||||||
e1.printStackTrace();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonObject object = Json.parse(apiOutput).asObject();
|
JsonObject object = Json.parse(apiOutput).asObject();
|
||||||
|
@ -89,8 +90,9 @@ public class updater implements Runnable{
|
||||||
pm.setMillisToPopup(0);
|
pm.setMillisToPopup(0);
|
||||||
pm.setMinimum(0);// tell the progress bar that we start at the beginning of the stream
|
pm.setMinimum(0);// tell the progress bar that we start at the beginning of the stream
|
||||||
pm.setMaximum(conn.getContentLength());// tell the progress bar the total number of bytes we are going to read.
|
pm.setMaximum(conn.getContentLength());// tell the progress bar the total number of bytes we are going to read.
|
||||||
FileUtils.copyInputStreamToFile(pmis, new File("ProjectHomeFlix.jar"));
|
FileUtils.copyInputStreamToFile(pmis, new File("ProjectHomeFlix_update.jar")); //download update
|
||||||
|
org.apache.commons.io.FileUtils.copyFile(new File("ProjectHomeFlix_update.jar"), new File("ProjectHomeFlix.jar")); //TODO rename update to old name
|
||||||
|
org.apache.commons.io.FileUtils.deleteQuietly(new File("ProjectHomeFlix_update.jar")); //delete update
|
||||||
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
|
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
|
||||||
System.exit(0); //finishes itself
|
System.exit(0); //finishes itself
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue