use zip and unzip from path (#161)

This commit is contained in:
Bryan MacFarlane
2019-09-24 17:07:08 -04:00
committed by GitHub
parent 3116829a9b
commit 67eeeea9fa
9 changed files with 8 additions and 30 deletions

View File

@@ -223,11 +223,7 @@ export async function extractZip(file: string, dest?: string): Promise<string> {
if (IS_WINDOWS) {
await extractZipWin(file, dest)
} else {
if (process.platform === 'darwin') {
await extractZipDarwin(file, dest)
} else {
await extractZipNix(file, dest)
}
await extractZipNix(file, dest)
}
return dest
@@ -255,18 +251,7 @@ async function extractZipWin(file: string, dest: string): Promise<void> {
}
async function extractZipNix(file: string, dest: string): Promise<void> {
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip')
await exec(`"${unzipPath}"`, [file], {cwd: dest})
}
async function extractZipDarwin(file: string, dest: string): Promise<void> {
const unzipPath = path.join(
__dirname,
'..',
'scripts',
'externals',
'unzip-darwin'
)
const unzipPath = await io.which('unzip')
await exec(`"${unzipPath}"`, [file], {cwd: dest})
}