Merge branch better-commands

This commit is contained in:
crschnick
2024-04-01 07:25:06 +00:00
parent 10ef67a6ec
commit d3c173dbcd
18 changed files with 185 additions and 237 deletions
@@ -5,6 +5,7 @@ import io.xpipe.app.browser.OpenFileSystemModel;
import io.xpipe.app.browser.action.BrowserActionFormatter;
import io.xpipe.app.browser.action.MultiExecuteAction;
import io.xpipe.app.browser.icon.BrowserIconFileType;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.ShellControl;
import java.util.List;
@@ -27,8 +28,8 @@ public class JarAction extends MultiExecuteAction implements JavaAction, FileTyp
}
@Override
protected String createCommand(ShellControl sc, OpenFileSystemModel model, BrowserEntry entry) {
return "java -jar " + entry.getOptionallyQuotedFileName();
protected CommandBuilder createCommand(ShellControl sc, OpenFileSystemModel model, BrowserEntry entry) {
return CommandBuilder.of().add("java", "-jar").addFile(entry.getRawFileEntry().getPath());
}
@Override
@@ -3,6 +3,7 @@ package io.xpipe.ext.base.browser;
import io.xpipe.app.browser.BrowserEntry;
import io.xpipe.app.browser.OpenFileSystemModel;
import io.xpipe.app.browser.action.MultiExecuteAction;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.process.OsType;
import io.xpipe.core.process.ShellControl;
import io.xpipe.core.process.ShellDialects;
@@ -69,8 +70,7 @@ public class RunAction extends MultiExecuteAction {
return entries.stream().allMatch(entry -> isExecutable(entry.getRawFileEntry()));
}
@Override
protected String createCommand(ShellControl sc, OpenFileSystemModel model, BrowserEntry entry) {
return sc.getShellDialect().runScriptCommand(sc, entry.getRawFileEntry().getPath());
protected CommandBuilder createCommand(ShellControl sc, OpenFileSystemModel model, BrowserEntry entry) {
return CommandBuilder.of().add(sc.getShellDialect().runScriptCommand(sc, entry.getRawFileEntry().getPath()));
}
}