mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-11-03 04:26:24 +00:00
Fix Linux editor detection
This commit is contained in:
1 parent
0bc01de98b
commit
e474b1b423
2 files changed
+14
-2
No files matched your search
@@ -1,7 +1,10 @@
|
||||
package io.xpipe.app.prefs;
|
||||
|
||||
import io.xpipe.core.process.OsType;
|
||||
import io.xpipe.core.process.ShellProcessControl;
|
||||
import io.xpipe.core.process.ShellTypes;
|
||||
import io.xpipe.core.store.ShellStore;
|
||||
import io.xpipe.extension.event.ErrorEvent;
|
||||
import io.xpipe.extension.prefs.PrefsChoiceValue;
|
||||
import io.xpipe.extension.util.ApplicationHelper;
|
||||
import io.xpipe.extension.util.WindowsRegistry;
|
||||
@@ -136,6 +139,15 @@ public abstract class ExternalEditorType implements PrefsChoiceValue {
|
||||
new ProcessBuilder(list).start();
|
||||
}
|
||||
|
||||
public boolean isAvailable() {
|
||||
try (ShellProcessControl pc = ShellStore.local().create().start()) {
|
||||
return pc.executeBooleanSimpleCommand(pc.getShellType().getWhichCommand(command));
|
||||
} catch (Exception e) {
|
||||
ErrorEvent.fromThrowable(e).omit().handle();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return OsType.getLocal().equals(OsType.LINUX);
|
||||
|
||||
Reference in new issue
Block a user