platform specific log file location support

This commit is contained in:
Craig Raw 2020-08-25 19:28:26 +02:00
parent 17773f783e
commit 274fb9afc3
2 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,21 @@
package com.sparrowwallet.drongo;
import ch.qos.logback.core.PropertyDefinerBase;
public class PropertyDefiner extends PropertyDefinerBase {
private String application;
public void setApplication(String application) {
this.application = application;
}
@Override
public String getPropertyValue() {
return isWindows() ? System.getenv("APPDATA") + "/" + application.substring(0, 1).toUpperCase() + application.substring(1) : System.getProperty("user.home") + "/." + application;
}
private boolean isWindows() {
String osName = System.getProperty("os.name");
return (osName != null && osName.toLowerCase().startsWith("windows"));
}
}

View file

@ -2,6 +2,7 @@ open module com.sparrowwallet.drongo {
requires org.bouncycastle.provider;
requires de.mkammerer.argon2;
requires slf4j.api;
requires logback.core;
requires json.simple;
requires jeromq;
exports com.sparrowwallet.drongo;