mirror of https://github.com/aminya/setup-cpp
Merge pull request #287 from aminya/unzip-windows [skip ci]
This commit is contained in:
commit
691fa792a8
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -90,13 +90,19 @@ export function extractExe(file: string, dest: string) {
|
||||||
|
|
||||||
/// Extract Zip using unzip or 7z
|
/// Extract Zip using unzip or 7z
|
||||||
export async function extractZip(file: string, dest: string) {
|
export async function extractZip(file: string, dest: string) {
|
||||||
// if unzip is available use it
|
// prefer 7z if available (faster especially on Windows)
|
||||||
|
if (which.sync("7z", { nothrow: true }) !== null) {
|
||||||
|
return extract7Zip(file, dest)
|
||||||
|
}
|
||||||
|
|
||||||
|
// if unzip is available use it (usually available on posix systems)
|
||||||
if (which.sync("unzip", { nothrow: true }) !== null) {
|
if (which.sync("unzip", { nothrow: true }) !== null) {
|
||||||
await execa("unzip", ["-q", file, "-d", dest], { stdio: "inherit" })
|
await execa("unzip", ["-q", file, "-d", dest], { stdio: "inherit" })
|
||||||
await grantUserWriteAccess(dest)
|
await grantUserWriteAccess(dest)
|
||||||
return dest
|
return dest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fallback to 7z (will install 7z if needed)
|
||||||
return extract7Zip(file, dest)
|
return extract7Zip(file, dest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue