Renamed NO_PARENT_NO_MOUNT_POINT to UNUSED_ROOT_DIR in MountPointRequirement

This commit is contained in:
JaniruTEC
2022-01-30 01:33:44 +01:00
parent 080ddbbb01
commit 1641a06d65
7 changed files with 9 additions and 9 deletions

View File

@@ -56,7 +56,7 @@ class CustomMountPointChooser implements MountPointChooser {
throw new InvalidMountPointException(new IllegalStateException("Illegal MountPointRequirement"));
}
default -> {
//Currently the case for "NO_PARENT_NO_MOUNT_POINT, PARENT_OPT_MOUNT_POINT"
//Currently the case for "UNUSED_ROOT_DIR, PARENT_OPT_MOUNT_POINT"
throw new InvalidMountPointException(new IllegalStateException("Not implemented"));
}
}

View File

@@ -65,7 +65,7 @@ class TemporaryMountPointChooser implements MountPointChooser {
throw new InvalidMountPointException(new IllegalStateException("Illegal MountPointRequirement"));
}
default -> {
//Currently the case for "NO_PARENT_NO_MOUNT_POINT, PARENT_OPT_MOUNT_POINT"
//Currently the case for "UNUSED_ROOT_DIR, PARENT_OPT_MOUNT_POINT"
throw new InvalidMountPointException(new IllegalStateException("Not implemented"));
}
}

View File

@@ -86,7 +86,7 @@ public class DokanyVolume extends AbstractVolume {
@Override
public MountPointRequirement getMountPointRequirement() {
return this.vaultSettings.getWinDriveLetter().isPresent() ? MountPointRequirement.NO_PARENT_NO_MOUNT_POINT : MountPointRequirement.EMPTY_MOUNT_POINT;
return this.vaultSettings.getWinDriveLetter().isPresent() ? MountPointRequirement.UNUSED_ROOT_DIR : MountPointRequirement.EMPTY_MOUNT_POINT;
}
public static boolean isSupportedStatic() {

View File

@@ -126,7 +126,7 @@ public class FuseVolume extends AbstractVolume {
if (!SystemUtils.IS_OS_WINDOWS) {
return MountPointRequirement.EMPTY_MOUNT_POINT;
}
return this.vaultSettings.getWinDriveLetter().isPresent() ? MountPointRequirement.NO_PARENT_NO_MOUNT_POINT : MountPointRequirement.PARENT_NO_MOUNT_POINT;
return this.vaultSettings.getWinDriveLetter().isPresent() ? MountPointRequirement.UNUSED_ROOT_DIR : MountPointRequirement.PARENT_NO_MOUNT_POINT;
}
public static boolean isSupportedStatic() {

View File

@@ -9,7 +9,7 @@ public enum MountPointRequirement {
/**
* The Mountpoint needs to be a filesystem root and must not exist.
*/
NO_PARENT_NO_MOUNT_POINT,
UNUSED_ROOT_DIR,
/**
* No Mountpoint on the local filesystem required. (e.g. WebDAV)

View File

@@ -42,14 +42,14 @@ public class UnlockInvalidMountPointController implements FxController {
}
public boolean getDriveLetterOccupied() {
return getMountPointRequirement() == MountPointRequirement.NO_PARENT_NO_MOUNT_POINT;
return getMountPointRequirement() == MountPointRequirement.UNUSED_ROOT_DIR;
}
private MountPointRequirement getMountPointRequirement() {
var requirement = vault.getVolume().orElseThrow(() -> new IllegalStateException("Invalid Mountpoint without a Volume?!")).getMountPointRequirement();
assert requirement != MountPointRequirement.NONE; //An invalid MountPoint with no required MountPoint doesn't seem sensible
assert requirement != MountPointRequirement.PARENT_OPT_MOUNT_POINT; //Not implemented anywhere (yet)
assert requirement != MountPointRequirement.NO_PARENT_NO_MOUNT_POINT || SystemUtils.IS_OS_WINDOWS; //Not implemented anywhere, but on Windows
assert requirement != MountPointRequirement.UNUSED_ROOT_DIR || SystemUtils.IS_OS_WINDOWS; //Not implemented anywhere, but on Windows
return requirement;
}

View File

@@ -83,7 +83,7 @@ public class UnlockWorkflow extends Task<Boolean> {
var requirement = vault.getVolume().orElseThrow(() -> new IllegalStateException("Invalid Mountpoint without a Volume?!", impExc)).getMountPointRequirement();
assert requirement != MountPointRequirement.NONE; //An invalid MountPoint with no required MountPoint doesn't seem sensible
assert requirement != MountPointRequirement.PARENT_OPT_MOUNT_POINT; //Not implemented anywhere (yet)
assert requirement != MountPointRequirement.NO_PARENT_NO_MOUNT_POINT || SystemUtils.IS_OS_WINDOWS; //Not implemented anywhere, but on Windows
assert requirement != MountPointRequirement.UNUSED_ROOT_DIR || SystemUtils.IS_OS_WINDOWS; //Not implemented anywhere, but on Windows
Throwable cause = impExc.getCause();
// TODO: apply https://openjdk.java.net/jeps/8213076 in future JDK versions
@@ -95,7 +95,7 @@ public class UnlockWorkflow extends Task<Boolean> {
}
showInvalidMountPointScene();
} else if (cause instanceof FileAlreadyExistsException) {
if (requirement == MountPointRequirement.NO_PARENT_NO_MOUNT_POINT) {
if (requirement == MountPointRequirement.UNUSED_ROOT_DIR) {
LOG.error("Unlock failed. Drive Letter already in use: {}", cause.getMessage());
} else {
LOG.error("Unlock failed. Mountpoint already exists: {}", cause.getMessage());