mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-18 02:31:27 +00:00
adding missing acces location text
This commit is contained in:
@@ -30,6 +30,7 @@ public class DokanyVolume implements Volume {
|
||||
private final MountFactory mountFactory;
|
||||
private final WindowsDriveLetters windowsDriveLetters;
|
||||
private Mount mount;
|
||||
private Path mountPoint;
|
||||
|
||||
@Inject
|
||||
public DokanyVolume(VaultSettings vaultSettings, ExecutorService executorService, WindowsDriveLetters windowsDriveLetters) {
|
||||
@@ -45,19 +46,19 @@ public class DokanyVolume implements Volume {
|
||||
|
||||
@Override
|
||||
public void mount(CryptoFileSystem fs, String mountFlags) throws VolumeException, IOException {
|
||||
Path mountPath = getMountPoint();
|
||||
this.mountPoint = determineMountPoint();
|
||||
String mountName = vaultSettings.mountName().get();
|
||||
try {
|
||||
this.mount = mountFactory.mount(fs.getPath("/"), mountPath, mountName, FS_TYPE_NAME, mountFlags.strip());
|
||||
this.mount = mountFactory.mount(fs.getPath("/"), mountPoint, mountName, FS_TYPE_NAME, mountFlags.strip());
|
||||
} catch (MountFailedException e) {
|
||||
if (vaultSettings.getIndividualMountPath().isPresent()) {
|
||||
LOG.warn("Failed to mount vault into {}. Is this directory currently accessed by another process (e.g. Windows Explorer)?", mountPath);
|
||||
LOG.warn("Failed to mount vault into {}. Is this directory currently accessed by another process (e.g. Windows Explorer)?", mountPoint);
|
||||
}
|
||||
throw new VolumeException("Unable to mount Filesystem", e);
|
||||
}
|
||||
}
|
||||
|
||||
private Path getMountPoint() throws VolumeException, IOException {
|
||||
private Path determineMountPoint() throws VolumeException, IOException {
|
||||
Optional<String> optionalCustomMountPoint = vaultSettings.getIndividualMountPath();
|
||||
if (optionalCustomMountPoint.isPresent()) {
|
||||
Path customMountPoint = Paths.get(optionalCustomMountPoint.get());
|
||||
@@ -99,6 +100,11 @@ public class DokanyVolume implements Volume {
|
||||
mount.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Path> getMountPointSafe() {
|
||||
return Optional.ofNullable(mountPoint);
|
||||
}
|
||||
|
||||
public static boolean isSupportedStatic() {
|
||||
return MountFactory.isApplicable();
|
||||
}
|
||||
|
||||
@@ -100,8 +100,7 @@ public class FuseVolume implements Volume {
|
||||
try {
|
||||
Mounter mounter = FuseMountFactory.getMounter();
|
||||
EnvironmentVariables envVars = EnvironmentVariables.create() //
|
||||
.withFlags(splitFlags(mountFlags))
|
||||
.withMountPoint(mountPoint) //
|
||||
.withFlags(splitFlags(mountFlags)).withMountPoint(mountPoint) //
|
||||
.build();
|
||||
this.fuseMnt = mounter.mount(root, envVars);
|
||||
} catch (CommandFailedException e) {
|
||||
@@ -166,6 +165,11 @@ public class FuseVolume implements Volume {
|
||||
return FuseVolume.isSupportedStatic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Path> getMountPointSafe() {
|
||||
return Optional.ofNullable(mountPoint);
|
||||
}
|
||||
|
||||
public static boolean isSupportedStatic() {
|
||||
return (SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_LINUX) && FuseMountFactory.isFuseSupported();
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ public class Vault {
|
||||
private final StringBinding defaultMountFlags;
|
||||
private final AtomicReference<CryptoFileSystem> cryptoFileSystem = new AtomicReference<>();
|
||||
private final ObjectProperty<State> state = new SimpleObjectProperty<State>(State.LOCKED);
|
||||
private final ObjectProperty<Path> accessPoint = new SimpleObjectProperty<>(Path.of(""));
|
||||
private final StringBinding displayableName;
|
||||
private final StringBinding displayablePath;
|
||||
private final BooleanBinding locked;
|
||||
@@ -81,6 +82,7 @@ public class Vault {
|
||||
this.locked = Bindings.createBooleanBinding(this::isLocked, state);
|
||||
this.processing = Bindings.createBooleanBinding(this::isProcessing, state);
|
||||
this.unlocked = Bindings.createBooleanBinding(this::isUnlocked, state);
|
||||
this.state.addListener(this::setAccessPoint);
|
||||
}
|
||||
|
||||
// ******************************************************************************
|
||||
@@ -219,6 +221,22 @@ public class Vault {
|
||||
return p.getFileName().toString();
|
||||
}
|
||||
|
||||
public ObjectProperty<Path> accessPointProperty() {
|
||||
return accessPoint;
|
||||
}
|
||||
|
||||
public Path getAccessPoint() {
|
||||
return accessPoint.get();
|
||||
}
|
||||
|
||||
private void setAccessPoint(Observable obs) {
|
||||
if (this.getState() == State.UNLOCKED) {
|
||||
accessPoint.setValue(volume.getMountPointSafe().get());
|
||||
} else {
|
||||
accessPoint.setValue(Path.of(""));
|
||||
}
|
||||
}
|
||||
|
||||
public StringBinding displayablePathProperty() {
|
||||
return displayablePath;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import org.cryptomator.common.settings.VolumeImpl;
|
||||
import org.cryptomator.cryptofs.CryptoFileSystem;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
@@ -28,6 +30,8 @@ public interface Volume {
|
||||
|
||||
void unmount() throws VolumeException;
|
||||
|
||||
Optional<Path> getMountPointSafe();
|
||||
|
||||
// optional forced unmounting:
|
||||
|
||||
default boolean supportsForcedUnmount() {
|
||||
|
||||
@@ -13,6 +13,8 @@ import javax.inject.Inject;
|
||||
import javax.inject.Provider;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Optional;
|
||||
|
||||
public class WebDavVolume implements Volume {
|
||||
|
||||
@@ -25,6 +27,7 @@ public class WebDavVolume implements Volume {
|
||||
private WebDavServer server;
|
||||
private WebDavServletController servlet;
|
||||
private Mounter.Mount mount;
|
||||
private Path mountPoint;
|
||||
|
||||
@Inject
|
||||
public WebDavVolume(Provider<WebDavServer> serverProvider, VaultSettings vaultSettings, Settings settings) {
|
||||
@@ -93,6 +96,11 @@ public class WebDavVolume implements Volume {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Path> getMountPointSafe() {
|
||||
return Optional.ofNullable(mountPoint);
|
||||
}
|
||||
|
||||
private String getLocalhostAliasOrNull() {
|
||||
try {
|
||||
InetAddress alias = InetAddress.getByName(LOCALHOST_ALIAS);
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<HBox styleClass="button-group,first" alignment="CENTER" onMouseClicked="#revealAccessLocation">
|
||||
<VBox styleClass="button-group-labels">
|
||||
<Label styleClass="button-group-heading" text="%vaultDetail.accessLocation"/>
|
||||
<Label text="${controller.vault.customMountPath}"/>
|
||||
<Label text="${controller.vault.accessPoint}"/>
|
||||
</VBox>
|
||||
<Region HBox.hgrow="ALWAYS"/>
|
||||
<Label styleClass="button-group-action" text="TODO REVEAL"/>
|
||||
|
||||
Reference in New Issue
Block a user