From e80cf7e4b02a0ae77aefb6c7621658b28682c0c9 Mon Sep 17 00:00:00 2001 From: crschnick Date: Wed, 16 Oct 2024 14:13:52 +0000 Subject: [PATCH] Improve windows terminal missing error message --- .../java/io/xpipe/app/terminal/WindowsTerminalType.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java b/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java index 26dfea913..5557c6dea 100644 --- a/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java +++ b/app/src/main/java/io/xpipe/app/terminal/WindowsTerminalType.java @@ -1,5 +1,6 @@ package io.xpipe.app.terminal; +import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.util.LocalShell; import io.xpipe.core.process.CommandBuilder; import io.xpipe.core.store.FileNames; @@ -67,6 +68,10 @@ public interface WindowsTerminalType extends ExternalTerminalType { @Override public void launch(LaunchConfiguration configuration) throws Exception { + if (!isAvailable()) { + throw ErrorEvent.expected(new IllegalArgumentException("Windows Terminal Preview is not installed")); + } + LocalShell.getShell() .executeSimpleCommand( CommandBuilder.of().addFile(getPath().toString()).add(toCommand(configuration))); @@ -98,6 +103,10 @@ public interface WindowsTerminalType extends ExternalTerminalType { @Override public void launch(LaunchConfiguration configuration) throws Exception { + if (!isAvailable()) { + throw ErrorEvent.expected(new IllegalArgumentException("Windows Terminal Canary is not installed")); + } + LocalShell.getShell() .executeSimpleCommand( CommandBuilder.of().addFile(getPath().toString()).add(toCommand(configuration)));