Updating WinDriveLetters since Dokany be installed in version 1.3.x

This commit is contained in:
Armin Schrenk
2019-10-16 15:57:08 +02:00
parent aec367dcc7
commit ca73c3ad90

View File

@@ -23,11 +23,11 @@ import java.util.stream.StreamSupport;
public final class WindowsDriveLetters {
private static final Logger LOG = LoggerFactory.getLogger(WindowsDriveLetters.class);
private static final Set<Path> D_TO_Z;
private static final Set<Path> A_TO_Z;
static {
try (IntStream stream = IntStream.rangeClosed('D', 'Z')) {
D_TO_Z = stream.mapToObj(i -> Path.of(((char) i)+":\\")).collect(Collectors.toSet());
try (IntStream stream = IntStream.rangeClosed('A', 'Z')) {
A_TO_Z = stream.mapToObj(i -> Path.of(((char) i)+":\\")).collect(Collectors.toSet());
}
}
@@ -48,7 +48,7 @@ public final class WindowsDriveLetters {
public Set<Path> getAvailableDriveLetters() {
Set<Path> occupiedDriveLetters = getOccupiedDriveLetters();
Predicate<Path> isOccupiedDriveLetter = occupiedDriveLetters::contains;
return D_TO_Z.stream().filter(isOccupiedDriveLetter.negate()).collect(Collectors.toSet());
return A_TO_Z.stream().filter(isOccupiedDriveLetter.negate()).collect(Collectors.toSet());
}
}