diff --git a/src/main/java/kellerkinder/HomeFlix/application/Main.java b/src/main/java/kellerkinder/HomeFlix/application/Main.java index 9d211f6..e2acd3a 100644 --- a/src/main/java/kellerkinder/HomeFlix/application/Main.java +++ b/src/main/java/kellerkinder/HomeFlix/application/Main.java @@ -112,12 +112,6 @@ public class Main extends Application { mainWindowController.setAutoUpdate(false); mainWindowController.setLocal(local); mainWindowController.saveSettings(); - try { - Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); // start again (preventing Bugs) TODO is this really needed - System.exit(0); // finishes it self - } catch (Exception e) { - LOGGER.error("error while restarting HomeFlix", e); - } } if (!posterCache.exists()) { @@ -152,10 +146,11 @@ public class Main extends Application { break; } - Alert alert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser + Alert alert = new Alert(AlertType.CONFIRMATION); //new alert with DirectoryChooser alert.setTitle("Project HomeFlix"); alert.setHeaderText(bundle.getString("firstStartHeader")); alert.setContentText(bundle.getString("firstStartContent")); + alert.setResizable(true); Optional result = alert.showAndWait(); if (result.get() == ButtonType.OK){ @@ -165,9 +160,12 @@ public class Main extends Application { path = selectedDirectory.getAbsolutePath(); } else { - path = ""; + LOGGER.warn("No directory selected!"); + System.exit(1); } + return path; + } public static void main(String[] args) { diff --git a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java index 918c9e6..6e152e3 100644 --- a/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java +++ b/src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java @@ -729,12 +729,17 @@ public class MainWindowController { try { // read old array - newsources = Json.parse(new FileReader(main.getDirectory() + "/sources.json")).asArray(); + File oldSources = new File(main.getDirectory() + "/sources.json"); + if (oldSources.exists()) { + newsources = Json.parse(new FileReader(main.getDirectory() + "/sources.json")).asArray(); + } else { + newsources = Json.array(); + } // add new source - Writer writer = new FileWriter(main.getDirectory() + "/sources.json"); source = Json.object().add("path", path).add("mode", mode); newsources.add(source); + Writer writer = new FileWriter(main.getDirectory() + "/sources.json"); newsources.writeTo(writer); writer.close(); } catch (IOException e) { diff --git a/src/main/resources/locals/HomeFlix-Local_de_DE.properties b/src/main/resources/locals/HomeFlix-Local_de_DE.properties index 544d512..d64608e 100644 --- a/src/main/resources/locals/HomeFlix-Local_de_DE.properties +++ b/src/main/resources/locals/HomeFlix-Local_de_DE.properties @@ -59,5 +59,6 @@ metascore = Metascore imdbRating = IMDB-Bewertung type = Type +#first start firstStartHeader = Es ist kein Stammverzeichnis f\u00FCr Filme angegeben! firstStartContent = Stammverzeichniss angeben? diff --git a/src/main/resources/locals/HomeFlix-Local_en_US.properties b/src/main/resources/locals/HomeFlix-Local_en_US.properties index ce5f4af..047f2c7 100644 --- a/src/main/resources/locals/HomeFlix-Local_en_US.properties +++ b/src/main/resources/locals/HomeFlix-Local_en_US.properties @@ -59,5 +59,6 @@ metascore = Metascore imdbRating = IMDB-Rating type = Type +#first start firstStartHeader = There is no root directory for movies! firstStartContent = Specify a root directory?