diff --git a/src/main/java/org/cryptomator/ui/addvaultwizard/ChooseExistingVaultController.java b/src/main/java/org/cryptomator/ui/addvaultwizard/ChooseExistingVaultController.java index 8399d6c61..56efa284b 100644 --- a/src/main/java/org/cryptomator/ui/addvaultwizard/ChooseExistingVaultController.java +++ b/src/main/java/org/cryptomator/ui/addvaultwizard/ChooseExistingVaultController.java @@ -94,7 +94,7 @@ public class ChooseExistingVaultController implements FxController { window.setScene(successScene.get()); } catch (NotAVaultDirectoryException e) { LOG.warn("Selected folder is not a vault directory: {}", e.getMessage()); - dialogs.prepareNotAVaultDirectoryDialog(window, e.notAVaultReason()).build().showAndWait(); + dialogs.prepareNotAVaultDirectoryDialog(window, e).build().showAndWait(); } catch (IOException e) { LOG.error("Failed to open existing vault.", e); appWindows.showErrorWindow(e, window, window.getScene()); diff --git a/src/main/java/org/cryptomator/ui/dialogs/Dialogs.java b/src/main/java/org/cryptomator/ui/dialogs/Dialogs.java index b614bed49..4933cefc7 100644 --- a/src/main/java/org/cryptomator/ui/dialogs/Dialogs.java +++ b/src/main/java/org/cryptomator/ui/dialogs/Dialogs.java @@ -140,8 +140,8 @@ public class Dialogs { .setCancelAction(Stage::close); } - public SimpleDialog.Builder prepareNotAVaultDirectoryDialog(Stage window, NotAVaultDirectoryException.Reason reason) { - String descriptionKey = switch (reason) { + public SimpleDialog.Builder prepareNotAVaultDirectoryDialog(Stage window, NotAVaultDirectoryException e) { + String descriptionKey = switch (e.notAVaultReason()) { case MISSING_DATA_DIR -> "addvaultwizard.existing.notAVault.description.missingDataDir"; case DATA_NOT_A_DIRECTORY -> "addvaultwizard.existing.notAVault.description.dataNotADirectory"; case MISSING_VAULT_CONFIG -> "addvaultwizard.existing.notAVault.description.missingVaultConfig"; @@ -152,7 +152,7 @@ public class Dialogs { .setOwner(window) // .setTitleKey("addvaultwizard.existing.notAVault.title") // .setMessageKey("addvaultwizard.existing.notAVault.message") // - .setDescriptionKey(descriptionKey) // + .setDescriptionKey(descriptionKey, e.path().getFileName() != null ? e.path().getFileName().toString() : e.path().toString()) // .setIcon(FontAwesome5Icon.EXCLAMATION) // .setOkButtonKey(BUTTON_KEY_CLOSE) // .setOkAction(Stage::close); diff --git a/src/main/java/org/cryptomator/ui/fxapp/AppLaunchEventHandler.java b/src/main/java/org/cryptomator/ui/fxapp/AppLaunchEventHandler.java index 4fe318202..77c774e6b 100644 --- a/src/main/java/org/cryptomator/ui/fxapp/AppLaunchEventHandler.java +++ b/src/main/java/org/cryptomator/ui/fxapp/AppLaunchEventHandler.java @@ -90,7 +90,7 @@ class AppLaunchEventHandler { LOG.debug("Added vault {}", potentialVaultPath); } catch (NotAVaultDirectoryException e) { LOG.warn("Cannot add {}: {}", potentialVaultPath, e.getMessage()); - Platform.runLater(() -> dialogs.prepareNotAVaultDirectoryDialog(primaryStage, e.notAVaultReason()).build().showAndWait()); + Platform.runLater(() -> dialogs.prepareNotAVaultDirectoryDialog(primaryStage, e).build().showAndWait()); } catch (IOException e) { LOG.error("Failed to add vault {}", potentialVaultPath, e); } diff --git a/src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java b/src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java index 46eca27a0..902b534fe 100644 --- a/src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java +++ b/src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java @@ -336,7 +336,7 @@ public class VaultListController implements FxController { vaultListManager.add(target); } catch (NotAVaultDirectoryException e) { LOG.warn("Cannot add {}: {}", target, e.getMessage()); - Platform.runLater(() -> dialogs.prepareNotAVaultDirectoryDialog(mainWindow, e.notAVaultReason()).build().showAndWait()); + Platform.runLater(() -> dialogs.prepareNotAVaultDirectoryDialog(mainWindow, e).build().showAndWait()); } catch (IOException e) { LOG.error("Failed to add vault {}", target, e); } diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index 69f2fe40f..ad04e102b 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -112,11 +112,11 @@ addvaultwizard.existing.filePickerTitle=Select Vault File addvaultwizard.existing.filePickerMimeDesc=Cryptomator Vault addvaultwizard.existing.notAVault.title=Not a Vault addvaultwizard.existing.notAVault.message=The selected folder is not a Cryptomator vault -addvaultwizard.existing.notAVault.description.missingDataDir=The required "d" subdirectory is missing inside the selected folder. -addvaultwizard.existing.notAVault.description.dataNotADirectory=The "d" entry inside the selected folder is not a directory. -addvaultwizard.existing.notAVault.description.missingVaultConfig=The required "vault.cryptomator" file is missing inside the selected folder . -addvaultwizard.existing.notAVault.description.vaultConfigAccessDenied=File "vault.cryptomator" cannot be read due to insufficient access rights. -addvaultwizard.existing.notAVault.description.unsupportedStructure=The directory structure of the selected folder is not supported. +addvaultwizard.existing.notAVault.description.missingDataDir=The required "d" subdirectory is missing inside "%s". +addvaultwizard.existing.notAVault.description.dataNotADirectory=The "d" entry inside "%s" is not a directory. +addvaultwizard.existing.notAVault.description.missingVaultConfig=The required "vault.cryptomator" file is missing inside "%s". +addvaultwizard.existing.notAVault.description.vaultConfigAccessDenied=File "vault.cryptomator" inside "%s" cannot be read due to insufficient access rights. +addvaultwizard.existing.notAVault.description.unsupportedStructure=The directory structure of "%s" is not supported. ## Success addvaultwizard.success.nextStepsInstructions=Added vault "%s".\nYou need to unlock this vault to access or add contents. Alternatively you can unlock it at any later point in time. addvaultwizard.success.unlockNow=Unlock Now