diff --git a/include/vcpkg/archives.h b/include/vcpkg/archives.h index dbecf5a84d..97b67b0531 100644 --- a/include/vcpkg/archives.h +++ b/include/vcpkg/archives.h @@ -21,7 +21,8 @@ namespace vcpkg SevenZip, Nupkg, Msi, - Exe + Exe, + SelfExtracting7z }; // Extract `archive` to `to_path` using `tar_tool`. diff --git a/src/vcpkg-test/archives.cpp b/src/vcpkg-test/archives.cpp index 76338403b8..4879832caf 100644 --- a/src/vcpkg-test/archives.cpp +++ b/src/vcpkg-test/archives.cpp @@ -15,4 +15,5 @@ TEST_CASE ("Testing guess_extraction_type", "[z-extract]") REQUIRE(guess_extraction_type(Path("/path/to/archive.xz")) == ExtractionType::Tar); REQUIRE(guess_extraction_type(Path("/path/to/archive.exe")) == ExtractionType::Exe); REQUIRE(guess_extraction_type(Path("/path/to/archive.unknown")) == ExtractionType::Unknown); + REQUIRE(guess_extraction_type(Path("/path/to/archive.7z.exe")) == ExtractionType::SelfExtracting7z); } diff --git a/src/vcpkg/archives.cpp b/src/vcpkg/archives.cpp index 0aee082352..b57b7faf1c 100644 --- a/src/vcpkg/archives.cpp +++ b/src/vcpkg/archives.cpp @@ -156,7 +156,16 @@ namespace vcpkg } else if (Strings::case_insensitive_ascii_equals(ext, ".exe")) { - return ExtractionType::Exe; + // Special case to differentiate between self-extracting 7z archives and other exe files + const auto stem = archive.stem(); + if (Strings::case_insensitive_ascii_equals(Path(stem).extension(), ".7z")) + { + return ExtractionType::SelfExtracting7z; + } + else + { + return ExtractionType::Exe; + } } else { @@ -188,6 +197,9 @@ namespace vcpkg extract_tar(tools.get_tool_path(Tools::TAR, status_sink), archive, to_path); break; case ExtractionType::Exe: + win32_extract_with_seven_zip(tools.get_tool_path(Tools::SEVEN_ZIP, status_sink), archive, to_path); + break; + case ExtractionType::SelfExtracting7z: const Path filename = archive.filename(); const Path stem = filename.stem(); const Path to_archive = Path(archive.parent_path()) / stem; diff --git a/vcpkg-init/vcpkg-scripts-sha.txt b/vcpkg-init/vcpkg-scripts-sha.txt index c643ac7793..7ecebbfbfe 100644 --- a/vcpkg-init/vcpkg-scripts-sha.txt +++ b/vcpkg-init/vcpkg-scripts-sha.txt @@ -1 +1 @@ -d033613d9021107e4a7b52c5fac1f87ae8a6fcc6 +0c4cf19224a049cf82f4521e29e39f7bd680440c