From f9043d6debd2ca2fe1553b6765f189f7ae7b94c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Autin?= Date: Wed, 23 Jun 2021 15:03:27 +0200 Subject: [PATCH] Fixed launcher failing to start if game.set is absent --- src/launcher/Config.java | 13 ++++++++++--- src/launcher/Launcher.java | 1 - 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/launcher/Config.java b/src/launcher/Config.java index 36c336c..055e5b8 100644 --- a/src/launcher/Config.java +++ b/src/launcher/Config.java @@ -71,12 +71,19 @@ public class Config { System.out.println("button for up is : " + up); */ } catch (FileNotFoundException e) { - e.printStackTrace(); + File f = new File("game.set"); + try { + f.createNewFile(); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + System.exit(1); + } + parse(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { - e.printStackTrace(); - + System.out.println("Empty config file"); } } diff --git a/src/launcher/Launcher.java b/src/launcher/Launcher.java index aad7b73..7c33e72 100644 --- a/src/launcher/Launcher.java +++ b/src/launcher/Launcher.java @@ -86,7 +86,6 @@ public class Launcher extends Application { public void runGame() { try { int width, height; - System.out.println(namespace.size()); ChoiceBox cb = (ChoiceBox) namespace.get("resolution"); switch (cb.getValue()) { case "640x480":