test loading fxml with system specific file separator

This commit is contained in:
Craig Raw 2022-07-28 15:11:59 +02:00
parent dab6b9663a
commit 28722d385b

View file

@ -25,12 +25,12 @@ import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import org.controlsfx.control.textfield.CustomPasswordField; import org.controlsfx.control.textfield.CustomPasswordField;
import org.controlsfx.control.textfield.TextFields;
import org.controlsfx.glyphfont.FontAwesome; import org.controlsfx.glyphfont.FontAwesome;
import org.controlsfx.glyphfont.Glyph; import org.controlsfx.glyphfont.Glyph;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.ResourceBundle; import java.util.ResourceBundle;
@ -91,6 +91,9 @@ public class WalletController extends WalletFormController implements Initializa
try { try {
if(!existing) { if(!existing) {
URL url = AppServices.class.getResource("wallet/" + function.toString().toLowerCase() + ".fxml"); URL url = AppServices.class.getResource("wallet/" + function.toString().toLowerCase() + ".fxml");
if(url == null) {
url = AppServices.class.getResource("wallet" + File.separator + function.toString().toLowerCase() + ".fxml");
}
if(url == null) { if(url == null) {
throw new IllegalStateException("Cannot find wallet/" + function.toString().toLowerCase() + ".fxml"); throw new IllegalStateException("Cannot find wallet/" + function.toString().toLowerCase() + ".fxml");
} }