fix: use the returned binDir from extractFunction

This commit is contained in:
Amin Yahyaabadi 2022-07-27 13:39:15 -07:00
parent d5d332b54c
commit 57de2d5de2
1 changed files with 7 additions and 3 deletions

View File

@ -82,8 +82,8 @@ export async function setupBin(
} }
} }
const installDir = join(setupDir, extractedFolderName) let installDir = join(setupDir, extractedFolderName)
const binDir = join(installDir, binRelativeDir) let binDir = join(installDir, binRelativeDir)
const binFile = join(binDir, binFileName) const binFile = join(binDir, binFileName)
// download ane extract the package into the installation directory. // download ane extract the package into the installation directory.
@ -113,7 +113,11 @@ export async function setupBin(
try { try {
const downloaded = await downloadTool(url) const downloaded = await downloadTool(url)
await extractFunction?.(downloaded, setupDir) const extractedBinDir = await extractFunction?.(downloaded, setupDir)
if (typeof extractedBinDir === "string") {
binDir = extractedBinDir
installDir = extractedBinDir
}
} catch (err) { } catch (err) {
throw new Error(`Failed to download ${name} ${version} ${arch} from ${url}: ${err}`) throw new Error(`Failed to download ${name} ${version} ${arch} from ${url}: ${err}`)
} }