mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-17 10:11:27 +00:00
fix missing logDir path resolution
This commit is contained in:
@@ -34,7 +34,10 @@ public class Environment {
|
||||
private static final String PLUGIN_DIR_PROP_NAME = "cryptomator.pluginDir";
|
||||
private static final String TRAY_ICON_PROP_NAME = "cryptomator.showTrayIcon";
|
||||
|
||||
private Environment() {}
|
||||
private Environment() {
|
||||
//hack, needed for logging directory to be setup correctly
|
||||
PropertiesPreprocessor.run();
|
||||
}
|
||||
|
||||
public void log() {
|
||||
LOG.info("user.home: {}", System.getProperty("user.home"));
|
||||
|
||||
@@ -33,9 +33,9 @@ public class PropertiesPreprocessor {
|
||||
return TEMPLATE.matcher(value).replaceAll(match -> //
|
||||
switch (match.group(1)) {
|
||||
case "appdir" -> ENV.get("APPDIR");
|
||||
case "appdata" -> ENV.get("APPDATA");
|
||||
case "localappdata" -> ENV.get("LOCALAPPDATA");
|
||||
case "userhome" -> System.getProperty("user.home");
|
||||
case "appdata" -> ENV.get("APPDATA").replace("\\","\\\\");
|
||||
case "localappdata" -> ENV.get("LOCALAPPDATA").replace("\\","\\\\");
|
||||
case "userhome" -> System.getProperty("user.home").replace("\\","\\\\");
|
||||
default -> {
|
||||
LOG.warn("Found unknown variable @{{}} in property value {}.", match.group(), value);
|
||||
yield match.group();
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.concurrent.Executors;
|
||||
@Singleton
|
||||
public class Cryptomator {
|
||||
|
||||
private static final Environment ENV = Environment.getInstance();
|
||||
private static final long STARTUP_TIME = System.currentTimeMillis();
|
||||
// DaggerCryptomatorComponent gets generated by Dagger.
|
||||
// Run Maven and include target/generated-sources/annotations in your IDE.
|
||||
@@ -37,15 +38,13 @@ public class Cryptomator {
|
||||
|
||||
private final DebugMode debugMode;
|
||||
private final SupportedLanguages supportedLanguages;
|
||||
private final Environment env;
|
||||
private final Lazy<IpcMessageHandler> ipcMessageHandler;
|
||||
private final ShutdownHook shutdownHook;
|
||||
|
||||
@Inject
|
||||
Cryptomator(DebugMode debugMode, SupportedLanguages supportedLanguages, Environment env, Lazy<IpcMessageHandler> ipcMessageHandler, ShutdownHook shutdownHook) {
|
||||
Cryptomator(DebugMode debugMode, SupportedLanguages supportedLanguages, Lazy<IpcMessageHandler> ipcMessageHandler, ShutdownHook shutdownHook) {
|
||||
this.debugMode = debugMode;
|
||||
this.supportedLanguages = supportedLanguages;
|
||||
this.env = env;
|
||||
this.ipcMessageHandler = ipcMessageHandler;
|
||||
this.shutdownHook = shutdownHook;
|
||||
}
|
||||
@@ -64,7 +63,6 @@ public class Cryptomator {
|
||||
System.out.printf("Cryptomator version %s (build %s)%n", appVer, buildNumber);
|
||||
return;
|
||||
}
|
||||
PropertiesPreprocessor.run();
|
||||
int exitCode = CRYPTOMATOR_COMPONENT.application().run(args);
|
||||
LOG.info("Exit {}", exitCode);
|
||||
System.exit(exitCode); // end remaining non-daemon threads.
|
||||
@@ -77,9 +75,9 @@ public class Cryptomator {
|
||||
* @return Nonzero exit code in case of an error.
|
||||
*/
|
||||
private int run(String[] args) {
|
||||
env.log();
|
||||
ENV.log();
|
||||
LOG.debug("Dagger graph initialized after {}ms", System.currentTimeMillis() - STARTUP_TIME);
|
||||
LOG.info("Starting Cryptomator {} on {} {} ({})", env.getAppVersion(), SystemUtils.OS_NAME, SystemUtils.OS_VERSION, SystemUtils.OS_ARCH);
|
||||
LOG.info("Starting Cryptomator {} on {} {} ({})", ENV.getAppVersion(), SystemUtils.OS_NAME, SystemUtils.OS_VERSION, SystemUtils.OS_ARCH);
|
||||
debugMode.initialize();
|
||||
supportedLanguages.applyPreferred();
|
||||
|
||||
@@ -87,7 +85,7 @@ public class Cryptomator {
|
||||
* Attempts to create an IPC connection to a running Cryptomator instance and sends it the given args.
|
||||
* If no external process could be reached, the args will be handled by the loopback IPC endpoint.
|
||||
*/
|
||||
try (var communicator = IpcCommunicator.create(env.ipcSocketPath().toList())) {
|
||||
try (var communicator = IpcCommunicator.create(ENV.ipcSocketPath().toList())) {
|
||||
if (communicator.isClient()) {
|
||||
communicator.sendHandleLaunchargs(List.of(args));
|
||||
communicator.sendRevealRunningApp();
|
||||
|
||||
Reference in New Issue
Block a user