diff --git a/app/src/main/java/io/xpipe/app/core/check/AppHomebrewCoreutilsCheck.java b/app/src/main/java/io/xpipe/app/core/check/AppHomebrewCoreutilsCheck.java index 8a8e91b8b..00e505f53 100644 --- a/app/src/main/java/io/xpipe/app/core/check/AppHomebrewCoreutilsCheck.java +++ b/app/src/main/java/io/xpipe/app/core/check/AppHomebrewCoreutilsCheck.java @@ -2,21 +2,23 @@ package io.xpipe.app.core.check; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.core.process.OsType; +import io.xpipe.core.store.FileNames; +import java.util.Optional; import java.util.concurrent.TimeUnit; public class AppHomebrewCoreutilsCheck { - public static boolean hasCoreutils() { + public static Optional checkCoreutils() { var fc = new ProcessBuilder("which", "stat").redirectErrorStream(true); try { var proc = fc.start(); var out = new String(proc.getInputStream().readAllBytes()); proc.waitFor(1, TimeUnit.SECONDS); var first = out.lines().findFirst(); - return first.map(s -> s.contains("coreutils")).orElse(false); + return first.filter(s -> s.contains("coreutils")).map(s -> FileNames.getParent(s)); } catch (Exception e) { - return false; + return Optional.empty(); } } @@ -25,8 +27,9 @@ public class AppHomebrewCoreutilsCheck { return; } - if (hasCoreutils()) { - ErrorEvent.fromMessage("You have the homebrew coreutils package installed and added to your PATH." + + var loc = checkCoreutils(); + if (loc.isPresent()) { + ErrorEvent.fromMessage("You have the homebrew coreutils package installed and added to your PATH at " + loc.get() + "." + " The coreutils commands overwrite and are incompatible to the native macOS commands, which XPipe expects." + " Please remove the coreutils commands from your PATH prior to launching XPipe.") .term()