Minor fix

- Launcher no longer loops infinitely when starting
This commit is contained in:
Gabriel Tofvesson 2016-11-14 19:46:53 +01:00
parent 22dd01a9da
commit c6d3a74a03
2 changed files with 9 additions and 12 deletions

View File

@ -33,7 +33,7 @@ public class Main extends Application {
// Semantic versioning system data
public static final String semVerDevState = "PreDev"; // Development stage
public static final int semVerMajor = 0; // Major version
public static final int semVerMinor = 2; // Minor version
public static final int semVerMinor = 0; // Minor version
public static final int semVerPatch = 1; // Patch version
private double xOffset = 0, yOffset = 0; // Offsets for dragging
@ -55,17 +55,14 @@ public class Main extends Application {
t.getKeyFrames().add(new KeyFrame(Duration.millis(1), event ->{ d.close(); primaryStage.show(); }));
d.initStyle(StageStyle.UNDECORATED);
Pane n = (Pane) Tabs.load("dialog_update");
//n.getChildren().add(new Label("Hello World"));
d.setScene(new Scene(n));
d.show();
new Thread(()->{
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Thread t1 = new Thread(()->{
try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); }
Updater.getInstance(t);
}).start();
});
t1.setDaemon(true);
t1.start();
}
primaryStage.initStyle(StageStyle.UNDECORATED); // Remove ugly trash
@ -173,9 +170,9 @@ public class Main extends Application {
public static void main(String[] args) throws Exception{
Main.args = args;
if(args.length>0){
if (args.length > 0) {
File f = new File(args[0]);
if(f.isFile()) while(!f.delete()) Thread.sleep(50); // Delete previous jar
if (f.isFile()) f.delete(); // Delete previous jar
}
launch(args);
}

View File

@ -70,7 +70,6 @@ public class Updater {
t.play();
return;
}
final int l=semMajor, j=semMinor, k=semPatch;
File f = new File("TAL-"+semMajor+"_"+semMinor+"_"+semPatch+".jar"), f1;
if((f1=new File(Main.class.getResource("/assets/").getFile())).getParent().contains("!") &&
f1.getParent().contains("file:")) // Find .jar representation of this program
@ -94,6 +93,7 @@ public class Updater {
while((i=reader.read(buffer))!=-1) o.write(buffer, 0, i);
reader.close();
o.close();
System.out.println("Starting!");
Runtime.getRuntime().exec("java -jar "+f.getName()+" "+f1.getAbsolutePath()+" "+false);
System.exit(0);
} catch (IOException e) {