mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-21 12:11:28 +00:00
Added MountPointRequirement-Enum
Added MountPointRequirement-Enum and added method getMountPointRequirement() to Volume (and all implementing classes) to query the requirment for the specific VolumeProvider.
This commit is contained in:
@@ -106,6 +106,11 @@ public class DokanyVolume implements Volume {
|
||||
return Optional.ofNullable(mountPoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MountPointRequirement getMountPointRequirement() {
|
||||
return MountPointRequirement.EMPTY_MOUNT_POINT;
|
||||
}
|
||||
|
||||
public static boolean isSupportedStatic() {
|
||||
return MountFactory.isApplicable();
|
||||
}
|
||||
|
||||
@@ -182,6 +182,11 @@ public class FuseVolume implements Volume {
|
||||
return Optional.ofNullable(mountPoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MountPointRequirement getMountPointRequirement() {
|
||||
return SystemUtils.IS_OS_WINDOWS ? MountPointRequirement.PARENT_NO_MOUNT_POINT : MountPointRequirement.EMPTY_MOUNT_POINT;
|
||||
}
|
||||
|
||||
public static boolean isSupportedStatic() {
|
||||
return FuseMountFactory.isFuseSupported();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.cryptomator.common.vaults;
|
||||
|
||||
/**
|
||||
* Enumeration used to indicate the requirements for mounting a vault
|
||||
* using a specific {@link Volume VolumeProvider}, e.g. {@link FuseVolume}.
|
||||
*/
|
||||
public enum MountPointRequirement {
|
||||
|
||||
/**
|
||||
* No Mountpoint on the local filesystem required. (e.g. WebDAV)
|
||||
*/
|
||||
NONE,
|
||||
|
||||
/**
|
||||
* A parent folder is required, but the actual Mountpoint must not exist.
|
||||
*/
|
||||
PARENT_NO_MOUNT_POINT,
|
||||
|
||||
/**
|
||||
* A parent folder is required, but the actual Mountpoint may exist.
|
||||
*/
|
||||
PARENT_OPT_MOUNT_POINT,
|
||||
|
||||
/**
|
||||
* The actual Mountpoint must exist, must be empty and the parent must exist aswell.
|
||||
*/
|
||||
EMPTY_MOUNT_POINT;
|
||||
|
||||
// /**
|
||||
// * The actual Mountpoint must exist and may contain files.
|
||||
// */
|
||||
// MOUNT_POINT;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -32,6 +32,8 @@ public interface Volume {
|
||||
|
||||
Optional<Path> getMountPoint();
|
||||
|
||||
MountPointRequirement getMountPointRequirement();
|
||||
|
||||
// optional forced unmounting:
|
||||
|
||||
default boolean supportsForcedUnmount() {
|
||||
|
||||
@@ -101,6 +101,11 @@ public class WebDavVolume implements Volume {
|
||||
return Optional.ofNullable(mountPoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MountPointRequirement getMountPointRequirement() {
|
||||
return MountPointRequirement.NONE;
|
||||
}
|
||||
|
||||
private String getLocalhostAliasOrNull() {
|
||||
try {
|
||||
InetAddress alias = InetAddress.getByName(LOCALHOST_ALIAS);
|
||||
|
||||
Reference in New Issue
Block a user