mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-02 10:41:40 +12:00
More installation fixes
This commit is contained in:
parent
c6c4b9cca9
commit
c17cbef675
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