mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-10-01 17:47:30 +13:00
Add more installation information
This commit is contained in:
parent
38021704ff
commit
a658b0391a
1 changed files with 27 additions and 0 deletions
|
@ -6,6 +6,7 @@ import io.xpipe.core.process.OsType;
|
||||||
import io.xpipe.core.process.ProcessOutputException;
|
import io.xpipe.core.process.ProcessOutputException;
|
||||||
import io.xpipe.core.process.ShellProcessControl;
|
import io.xpipe.core.process.ShellProcessControl;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class XPipeInstallation {
|
public class XPipeInstallation {
|
||||||
|
@ -26,6 +27,32 @@ public class XPipeInstallation {
|
||||||
return "\"" + command + "\" --external" + suffix;
|
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 {
|
public static String getInstallationBasePathForCLI(ShellProcessControl p, String cliExecutable) throws Exception {
|
||||||
var defaultInstallation = getDefaultInstallationBasePath(p, true);
|
var defaultInstallation = getDefaultInstallationBasePath(p, true);
|
||||||
if (cliExecutable == null) {
|
if (cliExecutable == null) {
|
||||||
|
|
Loading…
Reference in a new issue