electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.6k stars 1.73k forks source link

Question: Electron/Electron Builder get info about binary #8494

Open jrohlandt opened 3 days ago

jrohlandt commented 3 days ago

We are distributing our Electron app for Macs using Intel and also Apple Silicon. We are using electron-builder --mac --x64 --arm64 to create an Intel and ARM version.

I need a way to know if a user on Apple Silicon has accidentally installed the Intel version of the app. Currently I'm able to get the platform and architecture of the system. But how can I get the architecture that the .dmg file was built for? I thought "process.target_arch" would be it but it is always undefined.

Electron: ${process.versions["electron"]} Node: ${process.versions["node"]} Chromium: ${process.versions["chrome"]} Platform: ${os.platform} Architecture: ${os.arch} Target Arch: ${process?.target_arch} OS Version: ${process.getSystemVersion()}

mmaietta commented 3 days ago

I'm not sure it's possible to detect DMG architecture. I was under the impression that it wouldn't matter to the host system since the app within it could still be a different arch than what the OS of the DMG was built on/for.

FWIW, the electron-updater autoupdater should automatically update to the arm64 version of your app, even if the intel version was initially installed https://github.com/electron-userland/electron-builder/blob/afc6a34f404904712d25dfb591cc58da267d3b3e/packages/electron-updater/src/MacUpdater.ts#L81-L87

jrohlandt commented 1 day ago

Ok thanks.