Skip to content

Commit cb77508

Browse files
beyondkmpmmaietta
andauthored
feat: support upgrading from ARM to ARM, rather than upgrading to x64 in window and linux (electron-userland#9059)
Currently, there is no distinction between ARM and x64 on Windows and Linux, causing ARM devices to download the x64 version, which then fails to open. This PR aims to resolve this issue. macOS already supports ARM and has a more complex Rosetta mode, so it will retain the original filtering mechanism. Only Linux and Windows will adopt the new filtering approach. --------- Co-authored-by: Mike Maietta <[email protected]>
1 parent 312938d commit cb77508

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"electron-updater": patch
3+
---
4+
5+
feat: support upgrading from ARM to ARM, rather than upgrading to x64 in window and linux

packages/electron-updater/src/providers/Provider.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ export function findFile(files: Array<ResolvedUpdateFileInfo>, extension: string
8585
throw newError("No files provided", "ERR_UPDATER_NO_FILES_PROVIDED")
8686
}
8787

88-
const result = files.find(it => it.url.pathname.toLowerCase().endsWith(`.${extension.toLowerCase()}`))
89-
if (result != null) {
88+
const filteredFiles = files.filter(it => it.url.pathname.toLowerCase().endsWith(`.${extension.toLowerCase()}`))
89+
const result = filteredFiles.find(it => [it.url.pathname, it.info.url].some(n => n.includes(process.arch))) ?? filteredFiles.shift()
90+
91+
if (result) {
9092
return result
9193
} else if (not == null) {
9294
return files[0]

0 commit comments

Comments
 (0)