diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 19bf49f64..54938a0f0 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -2,8 +2,7 @@ import ch.qos.logback.classic.spi.Configurator; import org.cryptomator.common.locationpresets.DropboxLinuxLocationPresetsProvider; import org.cryptomator.common.locationpresets.DropboxMacLocationPresetsProvider; import org.cryptomator.common.locationpresets.DropboxWindowsLocationPresetsProvider; -import org.cryptomator.common.locationpresets.GoogleDriveWindowsLocationPresetsProvider; -import org.cryptomator.common.locationpresets.GoogleDriveMacLocationPresetsProvider; +import org.cryptomator.common.locationpresets.GoogleDriveLocationPresetsProvider; import org.cryptomator.common.locationpresets.ICloudMacLocationPresetsProvider; import org.cryptomator.common.locationpresets.ICloudWindowsLocationPresetsProvider; import org.cryptomator.common.locationpresets.LocationPresetsProvider; @@ -57,7 +56,7 @@ open module org.cryptomator.desktop { provides LocationPresetsProvider with DropboxMacLocationPresetsProvider, // DropboxWindowsLocationPresetsProvider, DropboxLinuxLocationPresetsProvider, // ICloudMacLocationPresetsProvider, ICloudWindowsLocationPresetsProvider, // - GoogleDriveWindowsLocationPresetsProvider, GoogleDriveMacLocationPresetsProvider, // + GoogleDriveLocationPresetsProvider, // PCloudLocationPresetsProvider, MegaLocationPresetsProvider, // OneDriveLinuxLocationPresetsProvider, OneDriveWindowsLocationPresetsProvider, // OneDriveMacLocationPresetsProvider; diff --git a/src/main/java/org/cryptomator/common/locationpresets/GoogleDriveLocationPresetsProvider.java b/src/main/java/org/cryptomator/common/locationpresets/GoogleDriveLocationPresetsProvider.java new file mode 100644 index 000000000..f54afe9af --- /dev/null +++ b/src/main/java/org/cryptomator/common/locationpresets/GoogleDriveLocationPresetsProvider.java @@ -0,0 +1,37 @@ +package org.cryptomator.common.locationpresets; + +import org.cryptomator.integrations.common.CheckAvailability; +import org.cryptomator.integrations.common.OperatingSystem; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.stream.Stream; + +import static org.cryptomator.integrations.common.OperatingSystem.Value.MAC; +import static org.cryptomator.integrations.common.OperatingSystem.Value.WINDOWS; + +@OperatingSystem(WINDOWS) +@OperatingSystem(MAC) +@CheckAvailability +public final class GoogleDriveLocationPresetsProvider implements LocationPresetsProvider { + + private static final Path LOCATION1 = LocationPresetsProvider.resolveLocation("~/GoogleDrive"); + private static final Path LOCATION2 = LocationPresetsProvider.resolveLocation("~/GoogleDrive/My Drive"); + + + @CheckAvailability + public static boolean isPresent() { + return Files.isDirectory(LOCATION1) || Files.isDirectory(LOCATION2); + } + + @Override + public Stream getLocations() { + if(Files.isDirectory(LOCATION1)) { + return Stream.of(new LocationPreset("Google Drive", LOCATION1)); + } else if(Files.isDirectory(LOCATION2)) { + return Stream.of(new LocationPreset("Google Drive", LOCATION2)); + } else { + return Stream.of(); + } + } +} diff --git a/src/main/java/org/cryptomator/common/locationpresets/GoogleDriveMacLocationPresetsProvider.java b/src/main/java/org/cryptomator/common/locationpresets/GoogleDriveMacLocationPresetsProvider.java deleted file mode 100644 index 5a555033c..000000000 --- a/src/main/java/org/cryptomator/common/locationpresets/GoogleDriveMacLocationPresetsProvider.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.cryptomator.common.locationpresets; - -import org.cryptomator.integrations.common.CheckAvailability; -import org.cryptomator.integrations.common.OperatingSystem; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.stream.Stream; - -import static org.cryptomator.integrations.common.OperatingSystem.Value.MAC; -import static org.cryptomator.integrations.common.OperatingSystem.Value.WINDOWS; - -@OperatingSystem(MAC) -@CheckAvailability -public final class GoogleDriveMacLocationPresetsProvider implements LocationPresetsProvider { - - private static final Path LOCATION = LocationPresetsProvider.resolveLocation("~/Google Drive/My Drive"); - - - @CheckAvailability - public static boolean isPresent() { - return Files.isDirectory(LOCATION); - } - - @Override - public Stream getLocations() { - return Stream.of(new LocationPreset("Google Drive", LOCATION)); - } -} diff --git a/src/main/java/org/cryptomator/common/locationpresets/GoogleDriveWindowsLocationPresetsProvider.java b/src/main/java/org/cryptomator/common/locationpresets/GoogleDriveWindowsLocationPresetsProvider.java deleted file mode 100644 index bc84bdee3..000000000 --- a/src/main/java/org/cryptomator/common/locationpresets/GoogleDriveWindowsLocationPresetsProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.cryptomator.common.locationpresets; - -import org.cryptomator.integrations.common.CheckAvailability; -import org.cryptomator.integrations.common.OperatingSystem; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.stream.Stream; - -import static org.cryptomator.integrations.common.OperatingSystem.Value.WINDOWS; - -@OperatingSystem(WINDOWS) -@CheckAvailability -public final class GoogleDriveWindowsLocationPresetsProvider implements LocationPresetsProvider { - - private static final Path LOCATION = LocationPresetsProvider.resolveLocation("~/Google Drive"); - - - @CheckAvailability - public static boolean isPresent() { - return Files.isDirectory(LOCATION); - } - - @Override - public Stream getLocations() { - return Stream.of(new LocationPreset("Google Drive", LOCATION)); - } -}