blob: 6d1b8aebfe00af3864e3c8e8116dc76df897b3c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include "generator/unpack_mwm.hpp"
#include "coding/file_container.hpp"
#include "coding/file_writer.hpp"
#include "coding/read_write_utils.hpp"
#include "base/logging.hpp"
#include "base/stl_add.hpp"
#include <algorithm>
#include <vector>
void UnpackMwm(std::string const & filePath)
{
LOG(LINFO, ("Unpacking mwm sections..."));
FilesContainerR container(filePath);
std::vector<std::string> tags;
container.ForEachTag(MakeBackInsertFunctor<std::vector<std::string> >(tags));
for (size_t i = 0; i < tags.size(); ++i)
{
LOG(LINFO, ("Unpacking", tags[i]));
ReaderSource<FilesContainerR::TReader> reader(container.GetReader(tags[i]));
FileWriter writer(filePath + "." + tags[i]);
rw::ReadAndWrite(reader, writer, 1024 * 1024);
}
LOG(LINFO, ("Unpacking done."));
}
void DeleteSection(std::string const & filePath, std::string const & tag)
{
FilesContainerW(filePath, FileWriter::OP_WRITE_EXISTING).DeleteSection(tag);
}
|