|
52 | 52 | #include "cuttlefish/host/libs/web/http_client/http_json.h" |
53 | 53 | #include "cuttlefish/host/libs/zip/remote_zip.h" |
54 | 54 | #include "cuttlefish/host/libs/zip/zip_cc.h" |
55 | | -#include "cuttlefish/host/libs/zip/zip_file.h" |
56 | 55 |
|
57 | 56 | namespace cuttlefish { |
58 | 57 | namespace { |
@@ -193,31 +192,31 @@ Result<std::string> AndroidBuildApi::DownloadFileWithBackup( |
193 | 192 | return DownloadTargetFile(build, target_directory, selected_artifact); |
194 | 193 | } |
195 | 194 |
|
196 | | -Result<ReadableZip> AndroidBuildApi::OpenZipArchive( |
197 | | - const Build& build, const std::string& archive_name) { |
198 | | - Result<ReadableZip> res = |
199 | | - std::visit([this, &archive_name]( |
200 | | - auto&& arg) { return OpenZipArchive(arg, archive_name); }, |
| 195 | +Result<SeekableZipSource> AndroidBuildApi::FileReader( |
| 196 | + const Build& build, const std::string& artifact_name) { |
| 197 | + Result<SeekableZipSource> res = |
| 198 | + std::visit([this, &artifact_name]( |
| 199 | + auto&& arg) { return FileReader(arg, artifact_name); }, |
201 | 200 | build); |
202 | 201 | return CF_EXPECT(std::move(res)); |
203 | 202 | } |
204 | 203 |
|
205 | | -Result<ReadableZip> AndroidBuildApi::OpenZipArchive( |
206 | | - const DeviceBuild& build, const std::string& archive_name) { |
207 | | - std::string url = CF_EXPECT(GetArtifactDownloadUrl(build, archive_name)); |
| 204 | +Result<SeekableZipSource> AndroidBuildApi::FileReader( |
| 205 | + const DeviceBuild& build, const std::string& artifact_name) { |
| 206 | + std::string url = CF_EXPECT(GetArtifactDownloadUrl(build, artifact_name)); |
208 | 207 | std::vector<std::string> headers = CF_EXPECT(Headers()); |
209 | | - return CF_EXPECT(ZipFromUrl(http_client, url, headers)); |
| 208 | + return CF_EXPECT(ZipSourceFromUrl(http_client, url, headers)); |
210 | 209 | } |
211 | 210 |
|
212 | | -Result<ReadableZip> AndroidBuildApi::OpenZipArchive( |
213 | | - const DirectoryBuild& build, const std::string& archive_name) { |
| 211 | +Result<SeekableZipSource> AndroidBuildApi::FileReader( |
| 212 | + const DirectoryBuild& build, const std::string& artifact_name) { |
214 | 213 | for (const std::string& path : build.paths) { |
215 | | - std::string zip_path_attempt = path + "/" + archive_name; |
| 214 | + std::string zip_path_attempt = path + "/" + artifact_name; |
216 | 215 | if (FileExists(zip_path_attempt)) { |
217 | | - return CF_EXPECT(ZipOpenRead(zip_path_attempt)); |
| 216 | + return CF_EXPECT(WritableZipSource::FromFile(zip_path_attempt)); |
218 | 217 | } |
219 | 218 | } |
220 | | - return CF_ERRF("Could not find '{}'", archive_name); |
| 219 | + return CF_ERRF("Could not find '{}'", artifact_name); |
221 | 220 | } |
222 | 221 |
|
223 | 222 | Result<std::vector<std::string>> AndroidBuildApi::Headers() { |
|
0 commit comments