浏览代码

support home-relative paths for cryptomator.keychainPath

Sebastian Stenzel 8 年之前
父节点
当前提交
5c4bf2a207

+ 5 - 2
main/keychain/src/main/java/org/cryptomator/keychain/WindowsProtectedKeychainAccess.java

@@ -64,11 +64,14 @@ class WindowsProtectedKeychainAccess implements KeychainAccessStrategy {
 		} else {
 			this.dataProtection = null;
 		}
-		final String keychainPathProperty = System.getProperty("cryptomator.keychainPath");
+		String keychainPathProperty = System.getProperty("cryptomator.keychainPath");
 		if (dataProtection != null && keychainPathProperty == null) {
-			LOG.warn("Windows DataProtection module loaded, but no keychainPath configured.");
+			LOG.warn("Windows DataProtection module loaded, but no cryptomator.keychainPath property found.");
 		}
 		if (keychainPathProperty != null) {
+			if (keychainPathProperty.startsWith("~/")) {
+				keychainPathProperty = SystemUtils.USER_HOME + keychainPathProperty.substring(1);
+			}
 			this.keychainPath = FileSystems.getDefault().getPath(keychainPathProperty);
 		} else {
 			this.keychainPath = null;