diff --git a/main/ui/src/main/java/org/cryptomator/ui/model/DokanyVolume.java b/main/ui/src/main/java/org/cryptomator/ui/model/DokanyVolume.java index 667ff5ff9..35aff5bcb 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/model/DokanyVolume.java +++ b/main/ui/src/main/java/org/cryptomator/ui/model/DokanyVolume.java @@ -1,9 +1,10 @@ package org.cryptomator.ui.model; import javax.inject.Inject; -import java.util.Iterator; +import java.util.Set; import java.util.concurrent.ExecutorService; +import com.google.common.collect.Sets; import org.cryptomator.common.settings.VaultSettings; import org.cryptomator.cryptofs.CryptoFileSystem; import org.cryptomator.frontend.dokany.Mount; @@ -28,7 +29,7 @@ public class DokanyVolume implements Volume { @Override public boolean isSupported() { - return this.isSupportedStatic(); + return DokanyVolume.isSupportedStatic(); } //TODO: Drive letter 'A' as mount point is invalid in dokany. maybe we should do already here something against it @@ -39,15 +40,10 @@ public class DokanyVolume implements Volume { driveLetter = vaultSettings.winDriveLetter().get().charAt(0); } else { //auto assign drive letter - //TODO: can we assume the we have at least one free drive letter? - - //this is a temporary fix for 'A' being an invalid drive letter if (!windowsDriveLetters.getAvailableDriveLetters().isEmpty()) { - Iterator winDriveLetterIt = windowsDriveLetters.getAvailableDriveLetters().iterator(); - do { - driveLetter = winDriveLetterIt.next(); - } while (winDriveLetterIt.hasNext() && driveLetter == 65); -// if (!windowsDriveLetters.getAvailableDriveLetters().isEmpty()) { + //this is a temporary fix for 'A' being an invalid drive letter + Set availableLettersWithoutA = Sets.difference(windowsDriveLetters.getAvailableDriveLetters(), Set.of('A')); + driveLetter = availableLettersWithoutA.iterator().next(); // driveLetter = windowsDriveLetters.getAvailableDriveLetters().iterator().next(); } else { throw new VolumeException("No free drive letter available."); diff --git a/main/ui/src/main/java/org/cryptomator/ui/model/FuseVolume.java b/main/ui/src/main/java/org/cryptomator/ui/model/FuseVolume.java index a11380ed1..ec63da443 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/model/FuseVolume.java +++ b/main/ui/src/main/java/org/cryptomator/ui/model/FuseVolume.java @@ -118,7 +118,7 @@ public class FuseVolume implements Volume { @Override public boolean isSupported() { - return this.isSupportedStatic(); + return FuseVolume.isSupportedStatic(); } public static boolean isSupportedStatic() { diff --git a/main/ui/src/main/java/org/cryptomator/ui/model/WebDavVolume.java b/main/ui/src/main/java/org/cryptomator/ui/model/WebDavVolume.java index bbd201351..2161e388d 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/model/WebDavVolume.java +++ b/main/ui/src/main/java/org/cryptomator/ui/model/WebDavVolume.java @@ -116,7 +116,7 @@ public class WebDavVolume implements Volume { @Override public boolean isSupported() { - return this.isSupportedStatic(); + return WebDavVolume.isSupportedStatic(); } @Override