|
@@ -2,6 +2,7 @@ package org.cryptomator.common;
|
|
|
|
|
|
import com.google.common.base.Splitter;
|
|
|
import com.google.common.base.Strings;
|
|
|
+import org.jetbrains.annotations.VisibleForTesting;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
@@ -43,15 +44,15 @@ public class Environment {
|
|
|
logCryptomatorSystemProperty(SETTINGS_PATH_PROP_NAME);
|
|
|
logCryptomatorSystemProperty(IPC_SOCKET_PATH_PROP_NAME);
|
|
|
logCryptomatorSystemProperty(KEYCHAIN_PATHS_PROP_NAME);
|
|
|
+ logCryptomatorSystemProperty(P12_PATH_PROP_NAME);
|
|
|
logCryptomatorSystemProperty(LOG_DIR_PROP_NAME);
|
|
|
logCryptomatorSystemProperty(LOOPBACK_ALIAS_PROP_NAME);
|
|
|
- logCryptomatorSystemProperty(PLUGIN_DIR_PROP_NAME);
|
|
|
logCryptomatorSystemProperty(MOUNTPOINT_DIR_PROP_NAME);
|
|
|
logCryptomatorSystemProperty(MIN_PW_LENGTH_PROP_NAME);
|
|
|
logCryptomatorSystemProperty(APP_VERSION_PROP_NAME);
|
|
|
logCryptomatorSystemProperty(BUILD_NUMBER_PROP_NAME);
|
|
|
+ logCryptomatorSystemProperty(PLUGIN_DIR_PROP_NAME);
|
|
|
logCryptomatorSystemProperty(TRAY_ICON_PROP_NAME);
|
|
|
- logCryptomatorSystemProperty(P12_PATH_PROP_NAME);
|
|
|
}
|
|
|
|
|
|
public static Environment getInstance() {
|
|
@@ -74,10 +75,6 @@ public class Environment {
|
|
|
return getPaths(SETTINGS_PATH_PROP_NAME);
|
|
|
}
|
|
|
|
|
|
- public Stream<Path> getP12Path() {
|
|
|
- return getPaths(P12_PATH_PROP_NAME);
|
|
|
- }
|
|
|
-
|
|
|
public Stream<Path> getIpcSocketPath() {
|
|
|
return getPaths(IPC_SOCKET_PATH_PROP_NAME);
|
|
|
}
|
|
@@ -86,6 +83,10 @@ public class Environment {
|
|
|
return getPaths(KEYCHAIN_PATHS_PROP_NAME);
|
|
|
}
|
|
|
|
|
|
+ public Stream<Path> getP12Path() {
|
|
|
+ return getPaths(P12_PATH_PROP_NAME);
|
|
|
+ }
|
|
|
+
|
|
|
public Optional<Path> getLogDir() {
|
|
|
return getPath(LOG_DIR_PROP_NAME);
|
|
|
}
|
|
@@ -94,14 +95,14 @@ public class Environment {
|
|
|
return Optional.ofNullable(System.getProperty(LOOPBACK_ALIAS_PROP_NAME));
|
|
|
}
|
|
|
|
|
|
- public Optional<Path> getPluginDir() {
|
|
|
- return getPath(PLUGIN_DIR_PROP_NAME);
|
|
|
- }
|
|
|
-
|
|
|
public Optional<Path> getMountPointsDir() {
|
|
|
return getPath(MOUNTPOINT_DIR_PROP_NAME);
|
|
|
}
|
|
|
|
|
|
+ public int getMinPwLength() {
|
|
|
+ return Integer.getInteger(MIN_PW_LENGTH_PROP_NAME, DEFAULT_MIN_PW_LENGTH);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Returns the app version defined in the {@value APP_VERSION_PROP_NAME} property or returns "SNAPSHOT".
|
|
|
*
|
|
@@ -115,8 +116,8 @@ public class Environment {
|
|
|
return Optional.ofNullable(System.getProperty(BUILD_NUMBER_PROP_NAME));
|
|
|
}
|
|
|
|
|
|
- public int getMinPwLength() {
|
|
|
- return Integer.getInteger(MIN_PW_LENGTH_PROP_NAME, DEFAULT_MIN_PW_LENGTH);
|
|
|
+ public Optional<Path> getPluginDir() {
|
|
|
+ return getPath(PLUGIN_DIR_PROP_NAME);
|
|
|
}
|
|
|
|
|
|
public boolean showTrayIcon() {
|
|
@@ -128,7 +129,7 @@ public class Environment {
|
|
|
return Optional.ofNullable(value).map(Paths::get);
|
|
|
}
|
|
|
|
|
|
- // visible for testing
|
|
|
+ @VisibleForTesting
|
|
|
Stream<Path> getPaths(String propertyName) {
|
|
|
Stream<String> rawSettingsPaths = getRawList(propertyName, System.getProperty("path.separator").charAt(0));
|
|
|
return rawSettingsPaths.filter(Predicate.not(Strings::isNullOrEmpty)).map(Path::of);
|