mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-17 10:11:27 +00:00
Fixed thrown exception
This commit is contained in:
@@ -30,7 +30,7 @@ public final class MountWithinParentUtil {
|
||||
if (!mpExists && !hideExists) { //neither mountpoint nor hideaway exist
|
||||
throw new MountPointNotExistingException(mountPoint);
|
||||
} else if (!mpExists) { //only hideaway exists
|
||||
checkIsDirectory(hideaway);
|
||||
checkIsHideawayDirectory(mountPoint, hideaway);
|
||||
LOG.info("Mountpoint {} seems to be not properly cleaned up. Will be fixed on unmount.", mountPoint);
|
||||
try {
|
||||
if (SystemUtils.IS_OS_WINDOWS) {
|
||||
@@ -86,9 +86,7 @@ public final class MountWithinParentUtil {
|
||||
}
|
||||
|
||||
private static void removeResidualHideaway(Path mountPoint, Path hideaway) throws IOException {
|
||||
if (!Files.isDirectory(hideaway, LinkOption.NOFOLLOW_LINKS)) {
|
||||
throw new HideawayNotDirectoryException(mountPoint, hideaway);
|
||||
}
|
||||
checkIsHideawayDirectory(mountPoint, hideaway);
|
||||
Files.delete(hideaway); //Fails if not empty
|
||||
}
|
||||
|
||||
@@ -134,6 +132,12 @@ public final class MountWithinParentUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkIsHideawayDirectory(Path mountPoint, Path hideawayToCheck) {
|
||||
if (!Files.isDirectory(hideawayToCheck, LinkOption.NOFOLLOW_LINKS)) {
|
||||
throw new HideawayNotDirectoryException(mountPoint, hideawayToCheck);
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkIsEmpty(Path toCheck) throws IllegalMountPointException, IOException {
|
||||
try (var dirStream = Files.list(toCheck)) {
|
||||
if (dirStream.findFirst().isPresent()) {
|
||||
|
||||
Reference in New Issue
Block a user