Skip to content

Commit

Permalink
Fix browser x64 detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexagon committed Mar 7, 2024
1 parent e560c87 commit 02129e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cross/runtime",
"version": "0.0.15",
"version": "0.0.16",
"exports": "./mod.ts",
"fmt": {
"lineWidth": 200,
Expand Down
12 changes: 8 additions & 4 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,17 @@ export function getCurrentArchitecture(): Architecture {
const userAgent = navigator.userAgent;
// @ts-ignore Cross Runtime
const platform = navigator.platform;
// Clues for x86/x64
if (platform.indexOf("Win64") !== -1 || platform.indexOf("x64") !== -1) {

if (platform.indexOf("Win64") !== -1 || platform.indexOf("x64") !== -1 || platform.indexOf("x86_64") !== -1) {
return Architecture.x64;
} else if (platform.indexOf("Win32") !== -1 || (platform.indexOf("x86") !== -1 && platform.indexOf("x86_64") === -1)) {
return Architecture.x86;
} else if (userAgent.indexOf("Win64") !== -1 || userAgent.indexOf("x64") !== -1 || userAgent.indexOf("x86_64") !== -1) {
return Architecture.x64;
} else if (platform.indexOf("Win32") !== -1 || platform.indexOf("x86") !== -1) {
} else if (userAgent.indexOf("Win32") !== -1 || (userAgent.indexOf("x86") !== -1 && userAgent.indexOf("x86_64") === -1)) {
return Architecture.x86;
}
// Clues for ARM

if (userAgent.indexOf("arm64") !== -1) {
return Architecture.arm64;
} else if (userAgent.indexOf("arm") !== -1) {
Expand Down

0 comments on commit 02129e9

Please sign in to comment.