filter hidden directories

This commit is contained in:
Jan-Peter Klein 2024-09-04 15:05:24 +02:00
parent 8fb95b67d9
commit 1946fc6c0e
No known key found for this signature in database
GPG Key ID: 90EDA3A7C822FD0E

View File

@ -79,6 +79,13 @@ public final class GoogleDriveMacLocationPresetsProvider implements LocationPres
try (var driveStream = Files.newDirectoryStream(accountPath, Files::isDirectory)) {
List<Path> directories = StreamSupport.stream(driveStream.spliterator(), false).toList();
return directories.stream()
.filter(drivePath -> {
try {
return !Files.isHidden(drivePath);
} catch (IOException e) {
throw new RuntimeException(e);
}
})
.map(drivePath -> new LocationPreset(getDriveLocationString(accountPath, drivePath), drivePath));
} catch (IOException e) {
return Stream.empty();