Fix beacon server start up failing

This commit is contained in:
Christopher Schnick 2022-12-19 19:55:51 +01:00
parent 402c6850a0
commit 32e9772154
4 changed files with 17 additions and 7 deletions

View file

@ -131,7 +131,7 @@ public final class XPipeApiConnection extends BeaconConnection {
}
private void start() throws Exception {
var installation = XPipeInstallation.getDefaultInstallationBasePath();
var installation = XPipeInstallation.getLocalDefaultInstallationBasePath();
BeaconServer.start(installation);
}

View file

@ -19,7 +19,7 @@ public class BeaconDaemonController {
if ((process = BeaconServer.tryStartCustom()) != null) {
custom = true;
} else {
var defaultBase = XPipeInstallation.getDefaultInstallationBasePath();
var defaultBase = XPipeInstallation.getLocalDefaultInstallationBasePath();
process = BeaconServer.start(defaultBase);
}

View file

@ -1,7 +1,6 @@
package io.xpipe.core.util;
import io.xpipe.core.impl.FileNames;
import io.xpipe.core.impl.LocalStore;
import io.xpipe.core.process.CommandProcessControl;
import io.xpipe.core.process.OsType;
import io.xpipe.core.process.ProcessOutputException;
@ -65,10 +64,21 @@ public class XPipeInstallation {
}
}
public static String getDefaultInstallationBasePath() throws Exception {
try (ShellProcessControl pc = new LocalStore().create().start()) {
return getDefaultInstallationBasePath(pc, true);
public static String getLocalDefaultInstallationBasePath() {
var customHome = System.getenv("XPIPE_HOME");
if (!customHome.isEmpty()) {
return customHome;
}
String path = null;
if (OsType.getLocal().equals(OsType.WINDOWS)) {
var base = System.getenv("LOCALAPPDATA");
path = FileNames.join(base, "X-Pipe");
} else {
path = "/opt/xpipe";
}
return path;
}
public static String getDefaultInstallationBasePath(ShellProcessControl p, boolean acceptPortable) throws Exception {

View file

@ -1 +1 @@
0.0.2.3
0.0.2.4-SNAPSHOT