diff --git a/pom.xml b/pom.xml index d6f9712..2eff729 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.erikmafo bigtableviewer - 0.1.8 + 0.1.9 jar bigtableviewer diff --git a/src/main/java/com/erikmafo/btviewer/controllers/MainController.java b/src/main/java/com/erikmafo/btviewer/controllers/MainController.java index 15aeafe..b68e90a 100644 --- a/src/main/java/com/erikmafo/btviewer/controllers/MainController.java +++ b/src/main/java/com/erikmafo/btviewer/controllers/MainController.java @@ -10,6 +10,9 @@ */ public class MainController { + @FXML + private MenuBarController menuBarController; + @FXML private QueryBoxController queryBoxController; diff --git a/src/main/java/com/erikmafo/btviewer/controllers/MenuBarController.java b/src/main/java/com/erikmafo/btviewer/controllers/MenuBarController.java index 4d45bd5..d5a1cc1 100644 --- a/src/main/java/com/erikmafo/btviewer/controllers/MenuBarController.java +++ b/src/main/java/com/erikmafo/btviewer/controllers/MenuBarController.java @@ -27,7 +27,9 @@ public class MenuBarController { private MenuBar menuBar; @Inject - public MenuBarController(LoadCredentialsPathService loadCredentialsPathService, SaveCredentialsPathService saveCredentialsPathService) { + public MenuBarController( + LoadCredentialsPathService loadCredentialsPathService, + SaveCredentialsPathService saveCredentialsPathService) { this.loadCredentialsPathService = loadCredentialsPathService; this.saveCredentialsPathService = saveCredentialsPathService; } diff --git a/src/main/java/com/erikmafo/btviewer/services/internal/AppDataStorageImpl.java b/src/main/java/com/erikmafo/btviewer/services/internal/AppDataStorageImpl.java index 9894a25..a1cc105 100644 --- a/src/main/java/com/erikmafo/btviewer/services/internal/AppDataStorageImpl.java +++ b/src/main/java/com/erikmafo/btviewer/services/internal/AppDataStorageImpl.java @@ -9,6 +9,8 @@ import org.mapdb.*; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.*; import java.util.concurrent.ConcurrentMap; import java.util.stream.Collectors; @@ -29,11 +31,18 @@ public static AppDataStorage createInMemory() { } public static AppDataStorage createInstance() { - var path = AppDataUtil - .getStorageFolder() - .resolve("database"); + var storageDir = AppDataUtil.getStorageFolder(); + if (!Files.exists(storageDir)) { + try { + Files.createDirectories(storageDir); + } catch (IOException e) { + return createInMemory(); + } + } + + var dbFile = storageDir.resolve("database").toFile(); var database = DBMaker - .fileDB(path.toFile()) + .fileDB(dbFile) .transactionEnable() .closeOnJvmShutdown() .make(); diff --git a/src/main/resources/fxml/main.fxml b/src/main/resources/fxml/main.fxml index cee5380..c4779d2 100644 --- a/src/main/resources/fxml/main.fxml +++ b/src/main/resources/fxml/main.fxml @@ -8,7 +8,7 @@ styleClass="pane-view"> - +