Add support for downloading aarch64-apple-darwin binaries, change naming convention

This commit is contained in:
Laurențiu Nicola 2020-12-22 16:46:01 +02:00
parent e1acb0ca5c
commit 5ff576f503

View file

@ -287,12 +287,14 @@ async function getServer(config: Config, state: PersistentState): Promise<string
if (config.package.releaseTag === null) return "rust-analyzer"; if (config.package.releaseTag === null) return "rust-analyzer";
let platform: string | undefined; let platform: string | undefined;
if (process.arch === "x64" || process.arch === "ia32") { if ((process.arch === "x64" || process.arch === "ia32") && process.platform === "win32") {
if (process.platform === "linux") platform = "linux"; platform = "x86_64-pc-windows-msvc";
if (process.platform === "darwin") platform = "mac"; } else if (process.arch === "x64" && process.platform === "linux") {
if (process.platform === "win32") platform = "windows"; platform = "x86_64-unknown-linux-gnu";
} else if (process.arch === "x64" && process.platform === "darwin") {
platform = "x86_64-apple-darwin";
} else if (process.arch === "arm64" && process.platform === "darwin") { } else if (process.arch === "arm64" && process.platform === "darwin") {
platform = "mac"; platform = "aarch64-apple-darwin";
} }
if (platform === undefined) { if (platform === undefined) {
vscode.window.showErrorMessage( vscode.window.showErrorMessage(
@ -305,7 +307,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string
); );
return undefined; return undefined;
} }
const ext = platform === "windows" ? ".exe" : ""; const ext = platform.indexOf("-windows-") !== -1 ? ".exe" : "";
const dest = path.join(config.globalStoragePath, `rust-analyzer-${platform}${ext}`); const dest = path.join(config.globalStoragePath, `rust-analyzer-${platform}${ext}`);
const exists = await fs.stat(dest).then(() => true, () => false); const exists = await fs.stat(dest).then(() => true, () => false);
if (!exists) { if (!exists) {