|
@@ -13,20 +13,30 @@ import java.nio.file.Paths;
|
|
|
public class LocationPresets {
|
|
|
|
|
|
private static final String USER_HOME = System.getProperty("user.home");
|
|
|
+ private static final String[] ICLOUDDRIVE_LOCATIONS = {"~/Library/Mobile Documents/iCloud~com~setolabs~Cryptomator/Documents"};
|
|
|
private static final String[] DROPBOX_LOCATIONS = {"~/Dropbox"};
|
|
|
private static final String[] GDRIVE_LOCATIONS = {"~/Google Drive"};
|
|
|
+ private static final String[] ONEDRIVE_LOCATIONS = {"~/OneDrive"};
|
|
|
|
|
|
+ private final ReadOnlyObjectProperty<Path> iclouddriveLocation;
|
|
|
private final ReadOnlyObjectProperty<Path> dropboxLocation;
|
|
|
private final ReadOnlyObjectProperty<Path> gdriveLocation;
|
|
|
+ private final ReadOnlyObjectProperty<Path> onedriveLocation;
|
|
|
+ private final BooleanBinding foundIclouddrive;
|
|
|
private final BooleanBinding foundDropbox;
|
|
|
private final BooleanBinding foundGdrive;
|
|
|
+ private final BooleanBinding foundOnedrive;
|
|
|
|
|
|
@Inject
|
|
|
public LocationPresets() {
|
|
|
+ this.iclouddriveLocation = new SimpleObjectProperty<>(existingWritablePath(ICLOUDDRIVE_LOCATIONS));
|
|
|
this.dropboxLocation = new SimpleObjectProperty<>(existingWritablePath(DROPBOX_LOCATIONS));
|
|
|
this.gdriveLocation = new SimpleObjectProperty<>(existingWritablePath(GDRIVE_LOCATIONS));
|
|
|
+ this.onedriveLocation = new SimpleObjectProperty<>(existingWritablePath(ONEDRIVE_LOCATIONS));
|
|
|
+ this.foundIclouddrive = iclouddriveLocation.isNotNull();
|
|
|
this.foundDropbox = dropboxLocation.isNotNull();
|
|
|
this.foundGdrive = gdriveLocation.isNotNull();
|
|
|
+ this.foundOnedrive = onedriveLocation.isNotNull();
|
|
|
}
|
|
|
|
|
|
private static Path existingWritablePath(String... candidates) {
|
|
@@ -49,6 +59,22 @@ public class LocationPresets {
|
|
|
|
|
|
/* Observables */
|
|
|
|
|
|
+ public ReadOnlyObjectProperty<Path> iclouddriveLocationProperty() {
|
|
|
+ return iclouddriveLocation;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Path getIclouddriveLocation() {
|
|
|
+ return iclouddriveLocation.get();
|
|
|
+ }
|
|
|
+
|
|
|
+ public BooleanBinding foundIclouddriveProperty() {
|
|
|
+ return foundIclouddrive;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isFoundIclouddrive() {
|
|
|
+ return foundIclouddrive.get();
|
|
|
+ }
|
|
|
+
|
|
|
public ReadOnlyObjectProperty<Path> dropboxLocationProperty() {
|
|
|
return dropboxLocation;
|
|
|
}
|
|
@@ -73,7 +99,7 @@ public class LocationPresets {
|
|
|
return gdriveLocation.get();
|
|
|
}
|
|
|
|
|
|
- public BooleanBinding froundGdriveProperty() {
|
|
|
+ public BooleanBinding foundGdriveProperty() {
|
|
|
return foundGdrive;
|
|
|
}
|
|
|
|
|
@@ -81,4 +107,20 @@ public class LocationPresets {
|
|
|
return foundGdrive.get();
|
|
|
}
|
|
|
|
|
|
+ public ReadOnlyObjectProperty<Path> onedriveLocationProperty() {
|
|
|
+ return onedriveLocation;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Path getOnedriveLocation() {
|
|
|
+ return onedriveLocation.get();
|
|
|
+ }
|
|
|
+
|
|
|
+ public BooleanBinding foundOnedriveProperty() {
|
|
|
+ return foundOnedrive;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isFoundOnedrive() {
|
|
|
+ return foundOnedrive.get();
|
|
|
+ }
|
|
|
+
|
|
|
}
|