Add rosetta check

This commit is contained in:
crschnick 2024-07-24 11:18:13 +00:00
parent 2ca2eefb29
commit dc93536be9
2 changed files with 28 additions and 0 deletions

View file

@ -0,0 +1,26 @@
package io.xpipe.app.core.check;
import io.xpipe.app.core.AppProperties;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.util.LocalShell;
import io.xpipe.core.process.OsType;
public class AppRosettaCheck {
public static void check() throws Exception {
if (OsType.getLocal() != OsType.MACOS) {
return;
}
if (!AppProperties.get().getArch().equals("x86_64")) {
return;
}
var ret = LocalShell.getShell().executeSimpleStringCommand("sysctl -n sysctl.proc_translated");
if (ret.equals("1")) {
ErrorEvent.fromMessage("You are running the Intel version of XPipe on an Apple Silicon system." +
" There is a native build available that comes with much better performance." +
" Please install that one instead.");
}
}
}

View file

@ -7,6 +7,7 @@ import io.xpipe.app.comp.store.StoreViewState;
import io.xpipe.app.core.*;
import io.xpipe.app.core.check.AppAvCheck;
import io.xpipe.app.core.check.AppCertutilCheck;
import io.xpipe.app.core.check.AppRosettaCheck;
import io.xpipe.app.core.check.AppShellCheck;
import io.xpipe.app.ext.ActionProvider;
import io.xpipe.app.ext.DataStoreProviders;
@ -51,6 +52,7 @@ public class BaseMode extends OperationMode {
AppSid.init();
LocalShell.init();
AppShellCheck.check();
AppRosettaCheck.check();
XPipeDistributionType.init();
AppPrefs.setLocalDefaultsIfNeeded();
// Initialize beacon server as we should be prepared for git askpass commands