Add log path to settings load error

Since they wouldn't be able to run the application to see the log path.

Also make no the default option
This commit is contained in:
2025-07-05 17:44:49 -07:00
parent 2992572651
commit 62bfbb1923

View File

@ -25,6 +25,7 @@ import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
@ -183,9 +184,20 @@ public class MainController implements Initializable {
Result<MainSettings, Exception> result = MainSettings.load();
if (!result.hasSuccess()) {
Alert alert = new Alert(Alert.AlertType.ERROR, "Unable to load settings file. See log for details. Reinitialize settings? This may overwrite existing settings.", ButtonType.YES, ButtonType.NO);
String logPath = Main.getStatePath().resolve("main.log").toString();
String message = "Unable to load settings file. See log file at " + logPath + " for details. Reinitialize settings? This may overwrite existing settings.";
Alert alert = new Alert(Alert.AlertType.ERROR, message, ButtonType.NO, ButtonType.YES);
alert.setTitle("Settings load error");
alert.setHeaderText(null);
//Deactivate Defaultbehavior for yes-Button:
Button yesButton = (Button) alert.getDialogPane().lookupButton( ButtonType.YES );
yesButton.setDefaultButton( false );
//Activate Defaultbehavior for no-Button:
Button noButton = (Button) alert.getDialogPane().lookupButton( ButtonType.NO );
noButton.setDefaultButton( true );
Optional<ButtonType> promptResult = alert.showAndWait();
if (!promptResult.isPresent()) {