Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jrohlandt opened this issue Sep 18, 2024 · 2 comments
Open

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

jrohlandt opened this issue Sep 18, 2024 · 2 comments

Comments

@jrohlandt
Copy link

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
Copy link
Collaborator

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

// allow arm64 macs to install universal or rosetta2(x64) - https://github.com/electron-userland/electron-builder/pull/5524
const isArm64 = (file: ResolvedUpdateFileInfo) => file.url.pathname.includes("arm64") || file.info.url?.includes("arm64")
if (isArm64Mac && files.some(isArm64)) {
files = files.filter(file => isArm64Mac === isArm64(file))
} else {
files = files.filter(file => !isArm64(file))
}

@jrohlandt jrohlandt changed the title Electron/Electron Builder get info about binary Question: Electron/Electron Builder get info about binary Sep 19, 2024
@jrohlandt
Copy link
Author

Ok thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants