diff --git a/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java b/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java index 0a2964467..3de4588f6 100644 --- a/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java +++ b/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java @@ -5,6 +5,7 @@ import io.xpipe.core.process.CommandProcessControl; import io.xpipe.core.process.OsType; import io.xpipe.core.process.ProcessOutputException; import io.xpipe.core.process.ShellProcessControl; +import lombok.SneakyThrows; import java.nio.file.Path; import java.util.List; @@ -27,8 +28,13 @@ public class XPipeInstallation { return "\"" + command + "\" --external" + suffix; } + @SneakyThrows public static Path getLocalInstallationBasePath() { - Path path = Path.of(ProcessHandle.current().info().command().orElseThrow()); + Path path = Path.of(ProcessHandle.current().info().command().orElseThrow()).toRealPath(); + if (!path.isAbsolute()) { + path = Path.of(System.getProperty("user.dir")).resolve(path).toRealPath(); + } + var name = path.getFileName().toString(); if (name.endsWith("java") || name.endsWith("java.exe")) { var isImage = ModuleHelper.isImage(); @@ -55,13 +61,13 @@ public class XPipeInstallation { public static Path getLocalExtensionsDirectory() { Path path = getLocalInstallationBasePath(); return OsType.getLocal().equals(OsType.MAC) - ? path.resolve("Contents").resolve("extensions") + ? path.resolve("Contents").resolve("Resources").resolve("extensions") : path.resolve("extensions"); } private static Path getLocalInstallationBasePathForJavaExecutable(Path executable) { if (OsType.getLocal().equals(OsType.MAC)) { - return executable.getParent().getParent().getParent().getParent().getParent(); + return executable.getParent().getParent().getParent().getParent().getParent().getParent(); } else if (OsType.getLocal().equals(OsType.LINUX)) { return executable.getParent().getParent().getParent().getParent(); } else { @@ -94,7 +100,7 @@ public class XPipeInstallation { } if (p.getOsType().equals(OsType.MAC)) { - return FileNames.getParent(FileNames.getParent(FileNames.getParent(FileNames.getParent(cliExecutable)))); + return FileNames.getParent(FileNames.getParent(FileNames.getParent(cliExecutable))); } else { return FileNames.getParent(FileNames.getParent(cliExecutable)); } @@ -169,7 +175,7 @@ public class XPipeInstallation { } else if (type.equals(OsType.LINUX)) { return FileNames.join("app", "scripts", "xpiped_debug.sh"); } else { - return FileNames.join("Content", "scripts", "xpiped_debug.sh"); + return FileNames.join("Content", "Resources", "scripts", "xpiped_debug.sh"); } } @@ -179,7 +185,7 @@ public class XPipeInstallation { } else if (type.equals(OsType.LINUX)) { return FileNames.join("app", "scripts", "xpiped_debug_attach.sh"); } else { - return FileNames.join("Content", "scripts", "xpiped_debug_attach.sh"); + return FileNames.join("Content", "Resources", "scripts", "xpiped_debug_attach.sh"); } } diff --git a/extension/src/main/java/io/xpipe/extension/event/TrackEvent.java b/extension/src/main/java/io/xpipe/extension/event/TrackEvent.java index 22877be49..c91a5adc9 100644 --- a/extension/src/main/java/io/xpipe/extension/event/TrackEvent.java +++ b/extension/src/main/java/io/xpipe/extension/event/TrackEvent.java @@ -106,7 +106,7 @@ public class TrackEvent { @Override public String toString() { - var s = new StringBuilder(message); + var s = new StringBuilder(message != null ? message : ""); if (tags.size() > 0) { s.append(" {\n"); for (var e : tags.entrySet()) { diff --git a/gradle_scripts/javafx.gradle b/gradle_scripts/javafx.gradle index f54b4c33f..e16ce739c 100644 --- a/gradle_scripts/javafx.gradle +++ b/gradle_scripts/javafx.gradle @@ -8,6 +8,10 @@ if (currentOS.isWindows()) { platform = 'linux' } else if (currentOS.isMacOsX()) { platform = 'mac' + def macArch = System.getProperty ("os.arch"); + if (macArch == 'aarch64') { + platform = 'mac-aarch64' + } } configurations {