Browse Source

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
pull/24/head
Jannik 4 years ago
parent
commit
4be971efee
  1. 14
      src/main/java/kellerkinder/HomeFlix/application/Main.java
  2. 9
      src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java
  3. 1
      src/main/resources/locals/HomeFlix-Local_de_DE.properties
  4. 1
      src/main/resources/locals/HomeFlix-Local_en_US.properties

14
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<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) {

9
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) {

1
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?

1
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?

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close