ソースを参照

Refactored UnlockInvalidMountPointController to use improved Exceptions

JaniruTEC 1 年間 前
コミット
9361a75cd8

+ 5 - 1
src/main/java/org/cryptomator/ui/unlock/UnlockInvalidMountPointController.java

@@ -14,6 +14,7 @@ import org.cryptomator.ui.vaultoptions.SelectedVaultOptionsTab;
 import javax.inject.Inject;
 import javafx.fxml.FXML;
 import javafx.stage.Stage;
+import java.nio.file.Path;
 import java.util.ResourceBundle;
 import java.util.concurrent.atomic.AtomicReference;
 
@@ -26,6 +27,7 @@ public class UnlockInvalidMountPointController implements FxController {
 	private final FxApplicationWindows appWindows;
 	private final ResourceBundle resourceBundle;
 	private final ExceptionType exceptionType;
+	private final Path exceptionPath;
 	private final String exceptionMessage;
 
 	public FormattedLabel dialogDescription;
@@ -39,13 +41,15 @@ public class UnlockInvalidMountPointController implements FxController {
 
 		var exc = illegalMountPointException.get();
 		this.exceptionType = getExceptionType(exc);
+		this.exceptionPath = exc.getMountpoint();
 		this.exceptionMessage = exc.getMessage();
 	}
 
 	@FXML
 	public void initialize() {
 		dialogDescription.setFormat(resourceBundle.getString(exceptionType.translationKey));
-		dialogDescription.setArg1(exceptionMessage);
+		dialogDescription.setArg1(exceptionPath);
+		dialogDescription.setArg2(exceptionMessage);
 	}
 
 	@FXML

+ 1 - 1
src/main/resources/i18n/strings.properties

@@ -131,7 +131,7 @@ unlock.error.customPath.message=Unable to mount vault to custom path
 unlock.error.customPath.description.notSupported=If you wish to keep using the custom path, please go to the preferences and select a volume type that supports it. Otherwise, go to the vault options and choose a supported mount point.
 unlock.error.customPath.description.notExists=The custom mount path does not exist. Either create it in your local filesystem or change it in the vault options.
 unlock.error.customPath.description.inUse=Drive letter "%s" is already in use.
-unlock.error.customPath.description.generic=You have selected a custom mount path for this vault, but using it failed with the message: %s
+unlock.error.customPath.description.generic=You have selected a custom mount path for this vault, but using it failed with the message: %2$s
 ## Hub
 hub.noKeychain.message=Unable to access device key
 hub.noKeychain.description=In order to unlock Hub vaults, a device key is required, which is secured using a keychain. To proceed, enable “%s” and select a keychain in the preferences.