mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-10-01 17:47:30 +13:00
More installation fixes
This commit is contained in:
parent
a658b0391a
commit
e130d1ab20
1 changed files with 14 additions and 2 deletions
|
@ -28,7 +28,12 @@ public class XPipeInstallation {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Path getLocalInstallationBasePath(){
|
public static Path getLocalInstallationBasePath(){
|
||||||
Path path = Path.of(System.getProperty("java.home"));
|
Path path = Path.of(ProcessHandle.current().info().command().orElseThrow());
|
||||||
|
var name = path.getFileName().toString();
|
||||||
|
if (name.endsWith("java") || name.endsWith("java.exe")) {
|
||||||
|
return Path.of(System.getProperty("user.dir"));
|
||||||
|
}
|
||||||
|
|
||||||
return getLocalInstallationBasePathForExecutable(path);
|
return getLocalInstallationBasePathForExecutable(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +48,14 @@ public class XPipeInstallation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Path getLocalInstallationBasePathForExecutable(Path executable) {
|
public static Path getLocalExtensionsDirectory() {
|
||||||
|
Path path = getLocalInstallationBasePath();
|
||||||
|
return OsType.getLocal().equals(OsType.MAC)
|
||||||
|
? path.resolve("Contents").resolve("extensions")
|
||||||
|
: path.resolve("extensions");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Path getLocalInstallationBasePathForExecutable(Path executable) {
|
||||||
if (OsType.getLocal().equals(OsType.MAC)) {
|
if (OsType.getLocal().equals(OsType.MAC)) {
|
||||||
return executable.getParent().getParent().getParent();
|
return executable.getParent().getParent().getParent();
|
||||||
} else if (OsType.getLocal().equals(OsType.LINUX)) {
|
} else if (OsType.getLocal().equals(OsType.LINUX)) {
|
||||||
|
|
Loading…
Reference in a new issue