Add more installation information

This commit is contained in:
Christopher Schnick 2022-12-28 03:30:06 +01:00
parent 38021704ff
commit a658b0391a

View file

@ -6,6 +6,7 @@ import io.xpipe.core.process.OsType;
import io.xpipe.core.process.ProcessOutputException;
import io.xpipe.core.process.ShellProcessControl;
import java.nio.file.Path;
import java.util.List;
public class XPipeInstallation {
@ -26,6 +27,32 @@ public class XPipeInstallation {
return "\"" + command + "\" --external" + suffix;
}
public static Path getLocalInstallationBasePath(){
Path path = Path.of(System.getProperty("java.home"));
return getLocalInstallationBasePathForExecutable(path);
}
public static Path getLocalDynamicLibraryDirectory() {
Path path = getLocalInstallationBasePath();
if (OsType.getLocal().equals(OsType.WINDOWS)) {
return path.resolve("runtime").resolve("bin");
} else if (OsType.getLocal().equals(OsType.LINUX)){
return path.resolve("lib").resolve("runtime").resolve("lib");
} else {
return path.resolve("Contents").resolve("runtime").resolve("Contents").resolve("Home").resolve("lib");
}
}
public static Path getLocalInstallationBasePathForExecutable(Path executable) {
if (OsType.getLocal().equals(OsType.MAC)) {
return executable.getParent().getParent().getParent();
} else if (OsType.getLocal().equals(OsType.LINUX)) {
return executable.getParent().getParent();
} else {
return executable.getParent();
}
}
public static String getInstallationBasePathForCLI(ShellProcessControl p, String cliExecutable) throws Exception {
var defaultInstallation = getDefaultInstallationBasePath(p, true);
if (cliExecutable == null) {