mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-19 03:01:27 +00:00
Merge pull request #2961 from sschuberth/win-drive-occupied
Show a dedicated message when mounting to an occupied Windows drive Fixes #2309
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package org.cryptomator.common.mount;
|
||||
|
||||
public class MountPointInUseException extends IllegalMountPointException {
|
||||
|
||||
public MountPointInUseException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,11 @@ public class Mounter {
|
||||
}
|
||||
} else {
|
||||
var mpIsDriveLetter = userChosenMountPoint.toString().matches("[A-Z]:\\\\");
|
||||
if (!mpIsDriveLetter && canMountToParent && !canMountToDir) {
|
||||
if (mpIsDriveLetter) {
|
||||
if (driveLetters.getOccupied().contains(userChosenMountPoint)) {
|
||||
throw new MountPointInUseException(userChosenMountPoint.toString());
|
||||
}
|
||||
} else if (canMountToParent && !canMountToDir) {
|
||||
MountWithinParentUtil.prepareParentNoMountPoint(userChosenMountPoint);
|
||||
cleanup = () -> {
|
||||
MountWithinParentUtil.cleanup(userChosenMountPoint);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.cryptomator.ui.unlock;
|
||||
|
||||
import org.cryptomator.common.mount.MountPointInUseException;
|
||||
import org.cryptomator.common.mount.MountPointNotExistsException;
|
||||
import org.cryptomator.common.mount.MountPointNotSupportedException;
|
||||
import org.cryptomator.common.vaults.Vault;
|
||||
@@ -41,6 +42,7 @@ public class UnlockInvalidMountPointController implements FxController {
|
||||
var translationKey = switch (e) {
|
||||
case MountPointNotSupportedException x -> "unlock.error.customPath.description.notSupported";
|
||||
case MountPointNotExistsException x -> "unlock.error.customPath.description.notExists";
|
||||
case MountPointInUseException x -> "unlock.error.customPath.description.inUse";
|
||||
default -> "unlock.error.customPath.description.generic";
|
||||
};
|
||||
dialogDescription.setFormat(resourceBundle.getString(translationKey));
|
||||
|
||||
Reference in New Issue
Block a user