mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-18 18:51:26 +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);
|
||||
|
||||
Reference in New Issue
Block a user