bug fixes
* fixed a crash at the first start on linux * fixed a crash caused by "" as source path * fixed HomeFlix is unable to start because sources.json is missing * removed one unnecessary restart
This commit is contained in:
		| @ -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<ButtonType> 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) { | ||||
|  | ||||
| @ -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) { | ||||
|  | ||||
| @ -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? | ||||
|  | ||||
| @ -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? | ||||
|  | ||||
		Reference in New Issue
	
	Block a user