mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 07:30:24 +00:00
macOS fixes
This commit is contained in:
parent
3ed9193028
commit
ef16a372c0
5 changed files with 35 additions and 4 deletions
|
@ -0,0 +1,30 @@
|
|||
package io.xpipe.app.core.check;
|
||||
|
||||
import io.xpipe.app.issue.ErrorEvent;
|
||||
import io.xpipe.app.util.LocalShell;
|
||||
import io.xpipe.core.process.OsType;
|
||||
import io.xpipe.core.process.ProcessOutputException;
|
||||
import io.xpipe.core.util.XPipeInstallation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class AppTestCommandCheck {
|
||||
|
||||
public static void check() throws Exception {
|
||||
if (OsType.getLocal().equals(OsType.WINDOWS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try (var sc = LocalShell.getShell().start()) {
|
||||
try {
|
||||
sc.getShellDialect().directoryExists(sc, XPipeInstallation.getCurrentInstallationBasePath().toString()).execute();
|
||||
} catch (ProcessOutputException ex) {
|
||||
throw ProcessOutputException.withPrefix(
|
||||
"Installation self test failed. Is your \"test\" shell command working as expected and is the XPipe installation directory accessible?", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -53,6 +53,7 @@ public class BaseMode extends OperationMode {
|
|||
LocalShell.init();
|
||||
AppShellCheck.check();
|
||||
AppRosettaCheck.check();
|
||||
AppTestCommandCheck.check();
|
||||
XPipeDistributionType.init();
|
||||
AppPrefs.setLocalDefaultsIfNeeded();
|
||||
// Initialize beacon server as we should be prepared for git askpass commands
|
||||
|
|
|
@ -127,7 +127,7 @@ public interface KittyTerminalType extends ExternalTerminalType {
|
|||
var socket = getSocket();
|
||||
try (var sc = LocalShell.getShell().start()) {
|
||||
if (sc.executeSimpleBooleanCommand(
|
||||
"/usr/bin/test -w " + sc.getShellDialect().fileArgument(socket))) {
|
||||
"test -w " + sc.getShellDialect().fileArgument(socket))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ public interface KittyTerminalType extends ExternalTerminalType {
|
|||
var socket = getSocket();
|
||||
try (var sc = LocalShell.getShell().start()) {
|
||||
if (sc.executeSimpleBooleanCommand(
|
||||
"/usr/bin/test -w " + sc.getShellDialect().fileArgument(socket))) {
|
||||
"test -w " + sc.getShellDialect().fileArgument(socket))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public class ShellTemp {
|
|||
}
|
||||
|
||||
var d = proc.getShellDialect();
|
||||
return proc.executeSimpleBooleanCommand("/usr/bin/test -r %s && /usr/bin/test -w %s && /usr/bin/test -x %s"
|
||||
return proc.executeSimpleBooleanCommand("test -r %s && test -w %s && test -x %s"
|
||||
.formatted(d.fileArgument(dir), d.fileArgument(dir), d.fileArgument(dir)));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public interface ElevationFunction {
|
|||
return false;
|
||||
}
|
||||
|
||||
var isRoot = shellControl.executeSimpleBooleanCommand("/usr/bin/test \"${EUID:-$(id -u)}\" -eq 0");
|
||||
var isRoot = shellControl.executeSimpleBooleanCommand("test \"${EUID:-$(id -u)}\" -eq 0");
|
||||
if (isRoot) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue