Skip to content

Commit

Permalink
Show name of system in path check
Browse files Browse the repository at this point in the history
  • Loading branch information
crschnick committed Jun 8, 2023
1 parent ed60342 commit 5dd9a3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected Optional<Path> determinePath() {
@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:
Expand Down Expand Up @@ -367,7 +367,7 @@ public void launch(String name, String file, boolean elevated) throws Exception
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);
Expand All @@ -377,7 +377,7 @@ public void launch(String name, String file, boolean elevated) throws Exception
}

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)) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/io/xpipe/app/util/ApplicationHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public static boolean isInPath(ShellControl processControl, String executable) t
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 : ""));
}
}
}

0 comments on commit 5dd9a3c

Please sign in to comment.