Show name of system in path check

This commit is contained in:
crschnick 2023-06-08 16:23:46 +00:00
parent ed60342f65
commit 5dd9a3c984
2 changed files with 5 additions and 5 deletions

View file

@ -125,7 +125,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
@Override
public void launch(String name, String file, boolean elevated) throws Exception {
try (ShellControl pc = LocalStore.getShell()) {
ApplicationHelper.checkSupport(pc, executable, getDisplayName());
ApplicationHelper.checkSupport(pc, executable, getDisplayName(), null);
var toExecute = executable + " " + toCommand(name, file);
// In order to fix this bug which also affects us:
@ -367,7 +367,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
try (ShellControl pc = LocalStore.getShell()
.subShell(ShellDialects.POWERSHELL)
.start()) {
ApplicationHelper.checkSupport(pc, executable, displayName);
ApplicationHelper.checkSupport(pc, executable, displayName, null);
var toExecute = "Start-Process \"" + executable + "\" -Verb RunAs -ArgumentList \""
+ toCommand(name, file).replaceAll("\"", "`\"") + "\"";
pc.executeSimpleCommand(toExecute);
@ -377,7 +377,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
}
try (ShellControl pc = LocalStore.getShell()) {
ApplicationHelper.checkSupport(pc, executable, displayName);
ApplicationHelper.checkSupport(pc, executable, displayName, null);
var toExecute = executable + " " + toCommand(name, file);
if (pc.getOsType().equals(OsType.WINDOWS)) {

View file

@ -27,10 +27,10 @@ public class ApplicationHelper {
processControl.getShellDialect().getWhichCommand(executable));
}
public static void checkSupport(ShellControl processControl, String executable, String displayName)
public static void checkSupport(ShellControl processControl, String executable, String displayName, String connectionName)
throws Exception {
if (!isInPath(processControl, executable)) {
throw new IOException(displayName + " executable " + executable + " not found in PATH");
throw new IOException(displayName + " executable " + executable + " not found in PATH" + (connectionName != null ? " on system " + connectionName : ""));
}
}
}