More mac fixes

This commit is contained in:
crschnick 2023-02-04 09:17:02 +00:00
parent fd05f9bb0f
commit 0ee12c8e5a

View file

@ -38,7 +38,11 @@ public abstract class ExternalApplicationType implements PrefsChoiceValue {
protected Optional<Path> getApplicationPath() {
try (ShellProcessControl pc = ShellStore.local().create().start()) {
try (var c = pc.command(String.format("osascript -e 'POSIX path of (path to application \"%s\")'", applicationName)).start()) {
try (var c = pc.command(String.format(
"/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister " +
"-dump | grep -o \"/.*%s.app\" | grep -v -E \"Caches|TimeMachine|Temporary|/Volumes/%s\" | uniq)'",
applicationName, applicationName))
.start()) {
var path = c.readOnlyStdout();
if (c.getExitCode() != 0) {
return Optional.empty();