From 2858dd9ad8a540138cf6569cc5958dd39c75405a Mon Sep 17 00:00:00 2001 From: Labhansh Agrawal Date: Mon, 31 Jan 2022 23:19:25 +0530 Subject: [PATCH] Use electron's arm64 detection --- app/updater.ts | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/app/updater.ts b/app/updater.ts index 7cfe4240..45ed7ffd 100644 --- a/app/updater.ts +++ b/app/updater.ts @@ -35,24 +35,9 @@ let isInit = false; // Default to the "stable" update channel let canaryUpdates = false; -// Detect if we are running inside Rosetta emulation -const isRosetta = () => { - if (platform !== 'darwin') { - return false; - } - const sysctlRosettaInfoKey = 'sysctl.proc_translated'; - let results = ''; - try { - results = execSync(`sysctl ${sysctlRosettaInfoKey}`).toString(); - } catch (error) { - console.log('Failed to detect Rosetta'); - } - return results.includes(`${sysctlRosettaInfoKey}: 1`); -}; - const buildFeedUrl = (canary: boolean, currentVersion: string) => { const updatePrefix = canary ? 'releases-canary' : 'releases'; - const archSuffix = process.arch === 'arm64' || isRosetta() ? '_arm64' : ''; + const archSuffix = process.arch === 'arm64' || app.runningUnderARM64Translation ? '_arm64' : ''; return `https://${updatePrefix}.hyper.is/update/${isLinux ? 'deb' : platform}${archSuffix}/${currentVersion}`; };