Updated webdav-nio-adapter to 1.0.0

This commit is contained in:
Sebastian Stenzel
2017-08-16 21:06:28 +02:00
parent d1a9233557
commit f84bb4710f
2 changed files with 18 additions and 1 deletions

View File

@@ -26,7 +26,7 @@
<!-- dependency versions -->
<cryptomator.cryptolib.version>1.1.5</cryptomator.cryptolib.version>
<cryptomator.cryptofs.version>1.4.1</cryptomator.cryptofs.version>
<cryptomator.webdav.version>0.6.2</cryptomator.webdav.version>
<cryptomator.webdav.version>1.0.0</cryptomator.webdav.version>
<cryptomator.jni.version>1.0.2</cryptomator.jni.version>
<commons-io.version>2.5</commons-io.version>

View File

@@ -9,6 +9,8 @@
package org.cryptomator.ui.model;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.file.DirectoryNotEmptyException;
import java.nio.file.DirectoryStream;
import java.nio.file.FileAlreadyExistsException;
@@ -60,6 +62,7 @@ public class Vault {
public static final Predicate<Vault> NOT_LOCKED = hasState(State.LOCKED).negate();
private static final Logger LOG = LoggerFactory.getLogger(Vault.class);
private static final String MASTERKEY_FILENAME = "masterkey.cryptomator";
private static final String LOCALHOST_ALIAS = "cryptomator-vault";
private final Settings settings;
private final VaultSettings vaultSettings;
@@ -137,6 +140,7 @@ public class Vault {
MountParams mountParams = MountParams.create() //
.withWindowsDriveLetter(vaultSettings.winDriveLetter().get()) //
.withPreferredGvfsScheme(settings.preferredGvfsScheme().get()) //
.withWebdavHostname(getLocalhostAliasOrNull()) //
.build();
Platform.runLater(() -> {
@@ -148,6 +152,19 @@ public class Vault {
});
}
private String getLocalhostAliasOrNull() {
try {
InetAddress alias = InetAddress.getByName(LOCALHOST_ALIAS);
if (alias.getHostAddress().equals("127.0.0.1")) {
return LOCALHOST_ALIAS;
} else {
return null;
}
} catch (UnknownHostException e) {
return null;
}
}
public synchronized void unmount() throws CommandFailedException {
unmount(Function.identity());
}