added @CheckAvailability
Some checks failed
Build / Compile and Test (push) Has been cancelled

changed exception handling
This commit is contained in:
Jan-Peter Klein 2024-09-24 15:29:13 +02:00
parent a03d5af144
commit c2c3d778d1
No known key found for this signature in database
GPG Key ID: 90EDA3A7C822FD0E

View File

@ -18,6 +18,7 @@ import java.util.stream.StreamSupport;
import static org.cryptomator.integrations.common.OperatingSystem.Value.MAC;
@OperatingSystem(MAC)
@CheckAvailability
public final class GoogleDriveMacLocationPresetsProvider implements LocationPresetsProvider {
private static final Path ROOT_LOCATION = LocationPresetsProvider.resolveLocation("~/Library/CloudStorage/").toAbsolutePath();
private static final Predicate<String> PATTERN = Pattern.compile("^GoogleDrive-[^/]+$").asMatchPredicate();
@ -82,9 +83,13 @@ public final class GoogleDriveMacLocationPresetsProvider implements LocationPres
return directories.stream()
.filter(drivePath -> {
try {
// Check if the directory is hidden. We want to exclude hidden directories
// from the results because they typically contain system or configuration
// files that are not relevant for the user.
return !Files.isHidden(drivePath);
} catch (IOException e) {
throw new RuntimeException(e);
LOG.debug("Could not determine if the path is hidden: {}", drivePath);
return false;
}
})
.map(drivePath -> new LocationPreset(getDriveLocationString(accountPath, drivePath), drivePath));