Small fixes for mac

This commit is contained in:
Christopher Schnick 2023-01-15 11:16:10 +01:00
parent 4a25a29fbb
commit 537a73589d
3 changed files with 17 additions and 7 deletions

View file

@ -5,6 +5,7 @@ import io.xpipe.core.process.CommandProcessControl;
import io.xpipe.core.process.OsType; 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 lombok.SneakyThrows;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.List; import java.util.List;
@ -27,8 +28,13 @@ public class XPipeInstallation {
return "\"" + command + "\" --external" + suffix; return "\"" + command + "\" --external" + suffix;
} }
@SneakyThrows
public static Path getLocalInstallationBasePath() { 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(); var name = path.getFileName().toString();
if (name.endsWith("java") || name.endsWith("java.exe")) { if (name.endsWith("java") || name.endsWith("java.exe")) {
var isImage = ModuleHelper.isImage(); var isImage = ModuleHelper.isImage();
@ -55,13 +61,13 @@ public class XPipeInstallation {
public static Path getLocalExtensionsDirectory() { public static Path getLocalExtensionsDirectory() {
Path path = getLocalInstallationBasePath(); Path path = getLocalInstallationBasePath();
return OsType.getLocal().equals(OsType.MAC) return OsType.getLocal().equals(OsType.MAC)
? path.resolve("Contents").resolve("extensions") ? path.resolve("Contents").resolve("Resources").resolve("extensions")
: path.resolve("extensions"); : path.resolve("extensions");
} }
private static Path getLocalInstallationBasePathForJavaExecutable(Path executable) { private static Path getLocalInstallationBasePathForJavaExecutable(Path executable) {
if (OsType.getLocal().equals(OsType.MAC)) { 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)) { } else if (OsType.getLocal().equals(OsType.LINUX)) {
return executable.getParent().getParent().getParent().getParent(); return executable.getParent().getParent().getParent().getParent();
} else { } else {
@ -94,7 +100,7 @@ public class XPipeInstallation {
} }
if (p.getOsType().equals(OsType.MAC)) { 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 { } else {
return FileNames.getParent(FileNames.getParent(cliExecutable)); return FileNames.getParent(FileNames.getParent(cliExecutable));
} }
@ -169,7 +175,7 @@ public class XPipeInstallation {
} else if (type.equals(OsType.LINUX)) { } else if (type.equals(OsType.LINUX)) {
return FileNames.join("app", "scripts", "xpiped_debug.sh"); return FileNames.join("app", "scripts", "xpiped_debug.sh");
} else { } 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)) { } else if (type.equals(OsType.LINUX)) {
return FileNames.join("app", "scripts", "xpiped_debug_attach.sh"); return FileNames.join("app", "scripts", "xpiped_debug_attach.sh");
} else { } else {
return FileNames.join("Content", "scripts", "xpiped_debug_attach.sh"); return FileNames.join("Content", "Resources", "scripts", "xpiped_debug_attach.sh");
} }
} }

View file

@ -106,7 +106,7 @@ public class TrackEvent {
@Override @Override
public String toString() { public String toString() {
var s = new StringBuilder(message); var s = new StringBuilder(message != null ? message : "");
if (tags.size() > 0) { if (tags.size() > 0) {
s.append(" {\n"); s.append(" {\n");
for (var e : tags.entrySet()) { for (var e : tags.entrySet()) {

View file

@ -8,6 +8,10 @@ if (currentOS.isWindows()) {
platform = 'linux' platform = 'linux'
} else if (currentOS.isMacOsX()) { } else if (currentOS.isMacOsX()) {
platform = 'mac' platform = 'mac'
def macArch = System.getProperty ("os.arch");
if (macArch == 'aarch64') {
platform = 'mac-aarch64'
}
} }
configurations { configurations {