| 436 | }; |
| 437 | |
| 438 | static void UnpackArchive(const TString& archive, const TFsPath& dir = TFsPath()) { |
| 439 | TMappingReader mappingReader(archive); |
| 440 | const TArchiveReader& reader = mappingReader.Reader; |
| 441 | const size_t count = reader.Count(); |
| 442 | for (size_t i = 0; i < count; ++i) { |
| 443 | const TString key = reader.KeyByIndex(i); |
| 444 | const TString fileName = CutFirstSlash(key); |
| 445 | if (!Quiet) { |
| 446 | Cerr << archive << " --> " << fileName << Endl; |
| 447 | } |
| 448 | const TFsPath path(dir / fileName); |
| 449 | path.Parent().MkDirs(); |
| 450 | TAutoPtr<IInputStream> in = reader.ObjectByKey(key); |
| 451 | TFixedBufferFileOutput out(path); |
| 452 | TransferData(in.Get(), &out); |
| 453 | out.Finish(); |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | static void ListArchive(const TString& archive, bool cutSlash) { |
| 458 | TMappingReader mappingReader(archive); |
no test coverage detected