diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 898ffc162..7988456ac 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -2,7 +2,7 @@ import ch.qos.logback.classic.spi.Configurator; import org.cryptomator.common.locationpresets.DropboxMacLocationPresetsProvider; import org.cryptomator.common.locationpresets.DropboxWindowsLocationPresetsProvider; import org.cryptomator.common.locationpresets.GoogleDriveMacLocationPresetsProvider; -import org.cryptomator.common.locationpresets.GoogleDriveWindowsLocationPresetsProvider; +import org.cryptomator.common.locationpresets.GoogleDriveLocationPresetsProvider; import org.cryptomator.common.locationpresets.ICloudMacLocationPresetsProvider; import org.cryptomator.common.locationpresets.ICloudWindowsLocationPresetsProvider; import org.cryptomator.common.locationpresets.LocationPresetsProvider; @@ -54,7 +54,7 @@ open module org.cryptomator.desktop { provides Configurator with LogbackConfiguratorFactory; provides LocationPresetsProvider with DropboxMacLocationPresetsProvider, // DropboxWindowsLocationPresetsProvider, ICloudMacLocationPresetsProvider, // - ICloudWindowsLocationPresetsProvider, GoogleDriveWindowsLocationPresetsProvider, // + ICloudWindowsLocationPresetsProvider, GoogleDriveLocationPresetsProvider, // GoogleDriveMacLocationPresetsProvider, PCloudLocationPresetsProvider, // MegaLocationPresetsProvider, OneDriveLocationPresetsProvider, OneDriveWindowsLocationPresetsProvider; } \ No newline at end of file diff --git a/src/main/java/org/cryptomator/common/locationpresets/DropboxMacLocationPresetsProvider.java b/src/main/java/org/cryptomator/common/locationpresets/DropboxMacLocationPresetsProvider.java index 9a8bb683d..abb61564d 100644 --- a/src/main/java/org/cryptomator/common/locationpresets/DropboxMacLocationPresetsProvider.java +++ b/src/main/java/org/cryptomator/common/locationpresets/DropboxMacLocationPresetsProvider.java @@ -13,16 +13,23 @@ import static org.cryptomator.integrations.common.OperatingSystem.Value.MAC; @CheckAvailability public final class DropboxMacLocationPresetsProvider implements LocationPresetsProvider { - private static final Path LOCATION = LocationPresetsProvider.resolveLocation("~/Library/CloudStorage/Dropbox"); + private static final Path LOCATION1 = LocationPresetsProvider.resolveLocation("~/Library/CloudStorage/Dropbox"); + private static final Path LOCATION2 = LocationPresetsProvider.resolveLocation("~/Dropbox"); @CheckAvailability public static boolean isPresent() { - return Files.isDirectory(LOCATION); + return Files.isDirectory(LOCATION1) || Files.isDirectory(LOCATION2); } @Override public Stream getLocations() { - return Stream.of(new LocationPreset("Dropbox", LOCATION)); + if(Files.isDirectory(LOCATION1)) { + return Stream.of(new LocationPreset("Dropbox", LOCATION1)); + } else if(Files.isDirectory(LOCATION2)) { + return Stream.of(new LocationPreset("Dropbox", LOCATION2)); + } else { + return Stream.of(); + } } } diff --git a/src/main/java/org/cryptomator/common/locationpresets/GoogleDriveWindowsLocationPresetsProvider.java b/src/main/java/org/cryptomator/common/locationpresets/GoogleDriveLocationPresetsProvider.java similarity index 79% rename from src/main/java/org/cryptomator/common/locationpresets/GoogleDriveWindowsLocationPresetsProvider.java rename to src/main/java/org/cryptomator/common/locationpresets/GoogleDriveLocationPresetsProvider.java index bc84bdee3..d816445da 100644 --- a/src/main/java/org/cryptomator/common/locationpresets/GoogleDriveWindowsLocationPresetsProvider.java +++ b/src/main/java/org/cryptomator/common/locationpresets/GoogleDriveLocationPresetsProvider.java @@ -7,11 +7,13 @@ 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 GoogleDriveWindowsLocationPresetsProvider implements LocationPresetsProvider { +public final class GoogleDriveLocationPresetsProvider implements LocationPresetsProvider { private static final Path LOCATION = LocationPresetsProvider.resolveLocation("~/Google Drive"); 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 6c0bee8fc..000000000 --- a/src/main/java/org/cryptomator/common/locationpresets/GoogleDriveMacLocationPresetsProvider.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.MAC; - -@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/OneDriveWindowsLocationPresetsProvider.java b/src/main/java/org/cryptomator/common/locationpresets/OneDriveWindowsLocationPresetsProvider.java index f1d63b430..ee02a51a7 100644 --- a/src/main/java/org/cryptomator/common/locationpresets/OneDriveWindowsLocationPresetsProvider.java +++ b/src/main/java/org/cryptomator/common/locationpresets/OneDriveWindowsLocationPresetsProvider.java @@ -76,7 +76,7 @@ public final class OneDriveWindowsLocationPresetsProvider implements LocationPre * @throws CommandFailedException Thrown when the process exit code is non-zero */ @Blocking - static void waitForSuccess(Process process, int timeoutSeconds, String cmdDescription) throws TimeoutException, InterruptedException, CommandFailedException { + private static void waitForSuccess(Process process, int timeoutSeconds, String cmdDescription) throws TimeoutException, InterruptedException, CommandFailedException { boolean exited = process.waitFor(timeoutSeconds, TimeUnit.SECONDS); if (!exited) { throw new TimeoutException(cmdDescription + " timed out after " + timeoutSeconds + "s"); @@ -88,7 +88,7 @@ public final class OneDriveWindowsLocationPresetsProvider implements LocationPre } } - static class CommandFailedException extends Exception { + private static class CommandFailedException extends Exception { int exitCode; String stdout;