Browse Source

changing volume provider requires restart due to macFUSE/FUSE-T lib loaded in same JVM

Armin Schrenk 2 years ago
parent
commit
86ccb1a58f

+ 18 - 1
src/main/java/org/cryptomator/common/mount/MountModule.java

@@ -2,11 +2,11 @@ package org.cryptomator.common.mount;
 
 import dagger.Module;
 import dagger.Provides;
-import org.cryptomator.common.ObservableUtil;
 import org.cryptomator.common.settings.Settings;
 import org.cryptomator.integrations.mount.MountService;
 
 import javax.inject.Singleton;
+import javafx.beans.property.SimpleObjectProperty;
 import javafx.beans.value.ObservableValue;
 import java.util.List;
 
@@ -19,6 +19,8 @@ public class MountModule {
 		return MountService.get().toList();
 	}
 
+	//currently not used, because macFUSE and FUSE-T cannot be used in the same JVM
+	/*
 	@Provides
 	@Singleton
 	static ObservableValue<ActualMountService> provideMountService(Settings settings, List<MountService> serviceImpls) {
@@ -30,5 +32,20 @@ public class MountModule {
 				}, //
 				new ActualMountService(fallbackProvider, true));
 	}
+	 */
+
+	@Provides
+	@Singleton
+	static ActualMountService provideActualMountService(Settings settings, List<MountService> serviceImpls) {
+		var fallbackProvider = serviceImpls.stream().findFirst().orElse(null);
+		var desiredService = serviceImpls.stream().filter(serviceImpl -> serviceImpl.getClass().getName().equals(settings.mountService().getValue())).findFirst(); //
+		return new ActualMountService(desiredService.orElse(fallbackProvider), desiredService.isPresent()); //
+	}
+
+	@Provides
+	@Singleton
+	static ObservableValue<ActualMountService> provideMountService(ActualMountService service) {
+		return new SimpleObjectProperty<>(service);
+	}
 
 }

+ 1 - 1
src/main/resources/i18n/strings.properties

@@ -276,7 +276,7 @@ preferences.interface.showMinimizeButton=Show minimize button
 preferences.interface.showTrayIcon=Show tray icon (requires restart)
 ## Volume
 preferences.volume=Virtual Drive
-preferences.volume.type=Volume Type
+preferences.volume.type=Volume Type (requires restart)
 preferences.volume.type.automatic=Automatic
 preferences.volume.tcp.port=TCP Port
 preferences.volume.supportedFeatures=The chosen volume type supports the following features: