mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-29 16:10:19 +00:00
Applied minor corrections
See: https://github.com/cryptomator/cryptomator/pull/2996#discussion_r1273277251 https://github.com/cryptomator/cryptomator/pull/2996#discussion_r1273280687 https://github.com/cryptomator/cryptomator/pull/2996#discussion_r1273287847
This commit is contained in:
@@ -65,8 +65,8 @@ public final class MountWithinParentUtil {
|
||||
return false;
|
||||
}
|
||||
if (!Files.readAttributes(path, BasicFileAttributes.class, LinkOption.NOFOLLOW_LINKS).isOther()) {
|
||||
checkIsDirectory(path);
|
||||
checkIsEmpty(path);
|
||||
checkIsMountPointDirectory(path);
|
||||
checkIsMountPointEmpty(path);
|
||||
return true;
|
||||
}
|
||||
if (Files.exists(path /* FOLLOW_LINKS */)) { //Both junction and target exist
|
||||
@@ -119,7 +119,7 @@ public final class MountWithinParentUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkIsDirectory(Path toCheck) throws IllegalMountPointException {
|
||||
private static void checkIsMountPointDirectory(Path toCheck) throws IllegalMountPointException {
|
||||
if (!Files.isDirectory(toCheck, LinkOption.NOFOLLOW_LINKS)) {
|
||||
throw new MountPointNotEmptyDirectoryException(toCheck, "Mountpoint is not a directory: " + toCheck);
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public final class MountWithinParentUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkIsEmpty(Path toCheck) throws IllegalMountPointException, IOException {
|
||||
private static void checkIsMountPointEmpty(Path toCheck) throws IllegalMountPointException, IOException {
|
||||
try (var dirStream = Files.list(toCheck)) {
|
||||
if (dirStream.findFirst().isPresent()) {
|
||||
throw new MountPointNotEmptyDirectoryException(toCheck, "Mountpoint directory is not empty: " + toCheck);
|
||||
|
||||
@@ -130,7 +130,7 @@ unlock.success.revealBtn=Reveal Drive
|
||||
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=The custom mount path "%s" is already in use.
|
||||
unlock.error.customPath.description.inUse=The drive letter or custom mount path "%s" is already in use.
|
||||
unlock.error.customPath.description.hideawayNotDir=The temporary, hidden file "%3$s" used for unlock could not be removed. Please check the file and then delete it manually.
|
||||
unlock.error.customPath.description.couldNotBeCleaned=Your vault could not be mounted to the path "%s". Please try again or choose a different path.
|
||||
unlock.error.customPath.description.notEmptyDir=The custom mount path "%s" is not an empty folder. Please choose an empty folder and try again.
|
||||
|
||||
@@ -206,7 +206,6 @@ class MountWithinParentUtilTest {
|
||||
var mount = Path.of("C:\\mount");
|
||||
var hideaway = getHideaway(mount);
|
||||
|
||||
assertEquals(mount.getParent().toAbsolutePath(), Path.of("C:\\").toAbsolutePath());
|
||||
assertEquals(mount.getParent(), hideaway.getParent());
|
||||
assertEquals(mount.getParent().resolve(".~$mount.tmp"), hideaway);
|
||||
assertEquals(mount.getParent().toAbsolutePath() + ".~$mount.tmp", hideaway.toAbsolutePath().toString());
|
||||
@@ -218,7 +217,6 @@ class MountWithinParentUtilTest {
|
||||
var mount = Path.of("/mount");
|
||||
var hideaway = getHideaway(mount);
|
||||
|
||||
assertEquals(mount.getParent().toAbsolutePath(), Path.of("/").toAbsolutePath());
|
||||
assertEquals(mount.getParent(), hideaway.getParent());
|
||||
assertEquals(mount.getParent().resolve(".~$mount.tmp"), hideaway);
|
||||
assertEquals(mount.getParent().toAbsolutePath() + ".~$mount.tmp", hideaway.toAbsolutePath().toString());
|
||||
|
||||
Reference in New Issue
Block a user