Skip to content

Commit f15441a

Browse files
committed
[feat] Account for non-Intel Macs to download the correct Java JRE
1 parent fdf3a6c commit f15441a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/providers/JavaDownload.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,25 @@ export async function getJre(ref: Ref): Promise<string> {
3333
const platform: NodeJS.Platform = await ipcRenderer.invoke('getPlatform');
3434
// const platform: NodeJS.Platform = 'linux';
3535

36+
const getMacArch = () => {
37+
const arch = os.arch();
38+
39+
if (arch === 'x64') {
40+
return 'x64';
41+
} else if (arch === 'arm64') {
42+
return 'aarch64';
43+
}
44+
45+
return arch;
46+
};
47+
3648
const flags = {
3749
// https://api.adoptium.net/q/swagger-ui/#/Binary/getBinary
3850
// /v3/binary/latest/{feature_version}/{release_type}/{os}/{arch}/{image_type}/{jvm_impl}/{heap_size}/{vendor}
3951
feature_version: '17', // Drehmal is 1.17+, so use JRE 17
4052
release_type: 'ga',
4153
os: osMap[platform],
42-
arch: os.arch(),
54+
arch: platform === 'darwin' ? getMacArch() : os.arch(),
4355
image_type: 'jre',
4456
jvm_impl: 'hotspot',
4557
heap_size: 'normal',

0 commit comments

Comments
 (0)