mirror of
https://github.com/zotero/zotero.git
synced 2026-09-27 01:21:27 +00:00
Warn users running non-ARM version on ARM CPU on Linux (#5461)
This commit is contained in:
parent
f8a1a2c6ed
commit
8355a95407
2 changed files with 51 additions and 2 deletions
|
|
@ -1419,6 +1419,55 @@ const { CommandLineOptions } = ChromeUtils.importESModule("chrome://zotero/conte
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
this.isLinux64EmulatedOnArm = function () {
|
||||
if (!this.isLinux) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We only check if x86_64 build is running on ARM
|
||||
if (this.arch !== "x86_64") {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
const { ctypes } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/ctypes.sys.mjs"
|
||||
);
|
||||
|
||||
let utsname = ctypes.StructType("utsname", [
|
||||
{ sysname: ctypes.ArrayType(ctypes.char, 65) },
|
||||
{ nodename: ctypes.ArrayType(ctypes.char, 65) },
|
||||
{ release: ctypes.ArrayType(ctypes.char, 65) },
|
||||
{ version: ctypes.ArrayType(ctypes.char, 65) },
|
||||
{ machine: ctypes.ArrayType(ctypes.char, 65) },
|
||||
{ domainname: ctypes.ArrayType(ctypes.char, 65) }
|
||||
]);
|
||||
|
||||
let libc = ctypes.open("libc.so.6");
|
||||
let unameC = libc.declare(
|
||||
"uname",
|
||||
ctypes.default_abi,
|
||||
ctypes.int,
|
||||
utsname.ptr
|
||||
);
|
||||
|
||||
let buf = utsname();
|
||||
if (unameC(buf.address()) !== 0) {
|
||||
libc.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
let machine = buf.machine.readString().trim(); // e.g., "x86_64", "aarch64"
|
||||
libc.close();
|
||||
|
||||
return ["aarch64", "arm64"].includes(machine.toLowerCase());
|
||||
}
|
||||
catch (e) {
|
||||
Zotero.logError(e);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get versions, platform, etc.
|
||||
|
|
|
|||
|
|
@ -6590,9 +6590,9 @@ var ZoteroPane = new function () {
|
|||
}
|
||||
|
||||
const isWow64 = (await Services.sysinfo.processInfo).isWow64;
|
||||
const isX64OnArm = Zotero.isWin64EmulatedOnArm();
|
||||
const isX64OnArm = Zotero.isWin64EmulatedOnArm() || Zotero.isLinux64EmulatedOnArm();
|
||||
|
||||
if (Zotero.isWin && (isWow64 || isX64OnArm)) {
|
||||
if ((Zotero.isWin && isWow64) || isX64OnArm) {
|
||||
let panel = document.getElementById('architecture-warning-container');
|
||||
let action = document.getElementById('architecture-warning-action');
|
||||
let close = document.getElementById('architecture-warning-close');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue