Add more error checking in getNightlyFileName (#237)

This commit is contained in:
Dilum Aluthge
2024-04-28 20:02:37 -04:00
committed by GitHub
parent 5fb759db5c
commit a515f9fb49
2 changed files with 37 additions and 8 deletions

25
lib/installer.js generated
View File

@@ -150,18 +150,32 @@ function getNightlyFileName(arch) {
let fileExt1; let fileExt1;
[fileExt1, ,] = getDesiredFileExts(); [fileExt1, ,] = getDesiredFileExts();
if (osPlat == 'win32') { if (osPlat == 'win32') {
versionExt = arch == 'x64' ? '-win64' : '-win32'; if (arch == 'x86') {
versionExt = '-win32';
}
else if (arch == 'aarch64') {
throw new Error('Aarch64 Julia is not available on Windows');
}
else if (arch == 'x64') {
versionExt = '-win64';
}
else {
throw new Error(`Architecture ${arch} is not supported on Windows`);
}
} }
else if (osPlat == 'darwin') { else if (osPlat == 'darwin') {
if (arch == 'x86') { if (arch == 'x86') {
throw new Error('32-bit Julia is not available on macOS'); throw new Error('32-bit (x86) Julia is not available on macOS');
} }
else if (arch == 'aarch64') { else if (arch == 'aarch64') {
versionExt = '-macaarch64'; versionExt = '-macaarch64';
} }
else { else if (arch == 'x64') {
versionExt = '-mac64'; versionExt = '-mac64';
} }
else {
throw new Error(`Architecture ${arch} is not supported on macOS`);
}
} }
else if (osPlat === 'linux') { else if (osPlat === 'linux') {
if (arch == 'x86') { if (arch == 'x86') {
@@ -170,9 +184,12 @@ function getNightlyFileName(arch) {
else if (arch == 'aarch64') { else if (arch == 'aarch64') {
versionExt = '-linux-aarch64'; versionExt = '-linux-aarch64';
} }
else { else if (arch == 'x64') {
versionExt = '-linux64'; versionExt = '-linux64';
} }
else {
throw new Error(`Architecture ${arch} is not supported on Linux`);
}
} }
else { else {
throw new Error(`Platform ${osPlat} is not supported`); throw new Error(`Platform ${osPlat} is not supported`);

View File

@@ -124,22 +124,34 @@ function getNightlyFileName(arch: string): string {
[fileExt1, , ] = getDesiredFileExts() [fileExt1, , ] = getDesiredFileExts()
if (osPlat == 'win32') { if (osPlat == 'win32') {
versionExt = arch == 'x64' ? '-win64' : '-win32' if (arch == 'x86') {
versionExt = '-win32'
} else if (arch == 'aarch64') {
throw new Error('Aarch64 Julia is not available on Windows')
} else if (arch == 'x64') {
versionExt = '-win64'
} else {
throw new Error(`Architecture ${arch} is not supported on Windows`)
}
} else if (osPlat == 'darwin') { } else if (osPlat == 'darwin') {
if (arch == 'x86') { if (arch == 'x86') {
throw new Error('32-bit Julia is not available on macOS') throw new Error('32-bit (x86) Julia is not available on macOS')
} else if (arch == 'aarch64') { } else if (arch == 'aarch64') {
versionExt = '-macaarch64' versionExt = '-macaarch64'
} else { } else if (arch == 'x64') {
versionExt = '-mac64' versionExt = '-mac64'
} else {
throw new Error(`Architecture ${arch} is not supported on macOS`)
} }
} else if (osPlat === 'linux') { } else if (osPlat === 'linux') {
if (arch == 'x86') { if (arch == 'x86') {
versionExt = '-linux32' versionExt = '-linux32'
} else if (arch == 'aarch64') { } else if (arch == 'aarch64') {
versionExt = '-linux-aarch64' versionExt = '-linux-aarch64'
} else { } else if (arch == 'x64') {
versionExt = '-linux64' versionExt = '-linux64'
} else {
throw new Error(`Architecture ${arch} is not supported on Linux`)
} }
} else { } else {
throw new Error(`Platform ${osPlat} is not supported`) throw new Error(`Platform ${osPlat} is not supported`)