Skip to content

Commit 02129e9

Browse files
committed
Fix browser x64 detection
1 parent e560c87 commit 02129e9

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cross/runtime",
3-
"version": "0.0.15",
3+
"version": "0.0.16",
44
"exports": "./mod.ts",
55
"fmt": {
66
"lineWidth": 200,

mod.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,17 @@ export function getCurrentArchitecture(): Architecture {
313313
const userAgent = navigator.userAgent;
314314
// @ts-ignore Cross Runtime
315315
const platform = navigator.platform;
316-
// Clues for x86/x64
317-
if (platform.indexOf("Win64") !== -1 || platform.indexOf("x64") !== -1) {
316+
317+
if (platform.indexOf("Win64") !== -1 || platform.indexOf("x64") !== -1 || platform.indexOf("x86_64") !== -1) {
318+
return Architecture.x64;
319+
} else if (platform.indexOf("Win32") !== -1 || (platform.indexOf("x86") !== -1 && platform.indexOf("x86_64") === -1)) {
320+
return Architecture.x86;
321+
} else if (userAgent.indexOf("Win64") !== -1 || userAgent.indexOf("x64") !== -1 || userAgent.indexOf("x86_64") !== -1) {
318322
return Architecture.x64;
319-
} else if (platform.indexOf("Win32") !== -1 || platform.indexOf("x86") !== -1) {
323+
} else if (userAgent.indexOf("Win32") !== -1 || (userAgent.indexOf("x86") !== -1 && userAgent.indexOf("x86_64") === -1)) {
320324
return Architecture.x86;
321325
}
322-
// Clues for ARM
326+
323327
if (userAgent.indexOf("arm64") !== -1) {
324328
return Architecture.arm64;
325329
} else if (userAgent.indexOf("arm") !== -1) {

0 commit comments

Comments
 (0)