diff --git a/src/main/java/org/cryptomator/common/LocationPreset.java b/src/main/java/org/cryptomator/common/LocationPreset.java index 1c984160c..89e55cf7f 100644 --- a/src/main/java/org/cryptomator/common/LocationPreset.java +++ b/src/main/java/org/cryptomator/common/LocationPreset.java @@ -11,7 +11,7 @@ import java.util.List; public enum LocationPreset { DROPBOX("Dropbox", "~/Dropbox"), - ICLOUD("iCloud Drive", "~/Library/Mobile Documents/com~apple~CloudDocs", "~/iCloudDrive"), + ICLOUDDRIVE("iCloud Drive", "~/Library/Mobile Documents/com~apple~CloudDocs", "~/iCloudDrive"), GDRIVE("Google Drive", "~/Google Drive/My Drive", "~/Google Drive"), MEGA("MEGA", "~/MEGA"), ONEDRIVE("OneDrive", "~/OneDrive"), @@ -43,12 +43,7 @@ public enum LocationPreset { * @return the first existing path or null, if none exists. */ public Path existingPath() { - for (Path candidate : candidates) { - if (Files.isDirectory(candidate)) { - return candidate; - } - } - return null; + return candidates.stream().filter(Files::isDirectory).findFirst().orElse(null); } @Override diff --git a/src/main/java/org/cryptomator/ui/addvaultwizard/ObservedLocationPresets.java b/src/main/java/org/cryptomator/ui/addvaultwizard/ObservedLocationPresets.java index 0a057845b..1c988dc04 100644 --- a/src/main/java/org/cryptomator/ui/addvaultwizard/ObservedLocationPresets.java +++ b/src/main/java/org/cryptomator/ui/addvaultwizard/ObservedLocationPresets.java @@ -26,7 +26,7 @@ public class ObservedLocationPresets { @Inject public ObservedLocationPresets() { - this.iclouddriveLocation = new SimpleObjectProperty<>(LocationPreset.ICLOUD.existingPath()); + this.iclouddriveLocation = new SimpleObjectProperty<>(LocationPreset.ICLOUDDRIVE.existingPath()); this.dropboxLocation = new SimpleObjectProperty<>(LocationPreset.DROPBOX.existingPath()); this.gdriveLocation = new SimpleObjectProperty<>(LocationPreset.GDRIVE.existingPath()); this.onedriveLocation = new SimpleObjectProperty<>(LocationPreset.ONEDRIVE.existingPath());