Parcourir la source

Apply suggestions from code review

Co-authored by: Tobias Hagemann <tobihagemann@users.noreply.github.com>
Armin Schrenk il y a 2 ans
Parent
commit
5832e8cd49

+ 2 - 7
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

+ 1 - 1
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());