forked from organicmaps/organicmaps
[generator] Fixed removing temporary files.
This commit is contained in:
parent
c10dffc2f1
commit
81cbc6c1de
3 changed files with 13 additions and 4 deletions
|
@ -60,7 +60,7 @@ class CollectorInterface
|
|||
{
|
||||
public:
|
||||
CollectorInterface(std::string const & filename = {}) : m_id(CreateId()), m_filename(filename) {}
|
||||
virtual ~CollectorInterface() { CHECK(Platform::RemoveFileIfExists(GetTmpFilename()), ()); }
|
||||
virtual ~CollectorInterface() { CHECK(Platform::RemoveFileIfExists(GetTmpFilename()), (GetTmpFilename())); }
|
||||
|
||||
virtual std::shared_ptr<CollectorInterface> Clone(
|
||||
std::shared_ptr<cache::IntermediateDataReaderInterface> const & = {}) const = 0;
|
||||
|
|
|
@ -274,6 +274,13 @@ RoutingCityBoundariesWriter::RoutingCityBoundariesWriter(std::string const & fil
|
|||
{
|
||||
}
|
||||
|
||||
RoutingCityBoundariesWriter::~RoutingCityBoundariesWriter()
|
||||
{
|
||||
CHECK(Platform::RemoveFileIfExists(m_nodeOsmIdToLocalityDataFilename), (m_nodeOsmIdToLocalityDataFilename));
|
||||
CHECK(Platform::RemoveFileIfExists(m_nodeOsmIdToBoundariesFilename), (m_nodeOsmIdToBoundariesFilename));
|
||||
CHECK(Platform::RemoveFileIfExists(m_finalBoundariesGeometryFilename), (m_finalBoundariesGeometryFilename));
|
||||
}
|
||||
|
||||
void RoutingCityBoundariesWriter::Process(uint64_t nodeOsmId, LocalityData const & localityData)
|
||||
{
|
||||
m_nodeOsmIdToLocalityDataWriter->Write(&nodeOsmId, sizeof(nodeOsmId));
|
||||
|
@ -306,17 +313,17 @@ void RoutingCityBoundariesWriter::Reset()
|
|||
void RoutingCityBoundariesWriter::MergeInto(RoutingCityBoundariesWriter & writer)
|
||||
{
|
||||
CHECK(!m_nodeOsmIdToLocalityDataWriter || !writer.m_nodeOsmIdToLocalityDataWriter,
|
||||
("Finish() has not been called."));
|
||||
("Reset() has not been called."));
|
||||
base::AppendFileToFile(m_nodeOsmIdToLocalityDataFilename,
|
||||
writer.m_nodeOsmIdToLocalityDataFilename);
|
||||
|
||||
CHECK(!m_nodeOsmIdToBoundariesWriter || !writer.m_nodeOsmIdToBoundariesWriter,
|
||||
("Finish() has not been called."));
|
||||
("Reset() has not been called."));
|
||||
base::AppendFileToFile(m_nodeOsmIdToBoundariesFilename,
|
||||
writer.m_nodeOsmIdToBoundariesFilename);
|
||||
|
||||
CHECK(!m_finalBoundariesGeometryWriter || !writer.m_finalBoundariesGeometryWriter,
|
||||
("Finish() has not been called."));
|
||||
("Reset() has not been called."));
|
||||
base::AppendFileToFile(m_finalBoundariesGeometryFilename,
|
||||
writer.m_finalBoundariesGeometryFilename);
|
||||
|
||||
|
@ -335,6 +342,7 @@ void RoutingCityBoundariesWriter::Save(std::string const & finalFileName,
|
|||
|
||||
base::AppendFileToFile(m_nodeOsmIdToLocalityDataFilename, nodeToLocalityFilename);
|
||||
base::AppendFileToFile(m_nodeOsmIdToBoundariesFilename, nodeToBoundariesFilename);
|
||||
|
||||
if (Platform::IsFileExistsByFullPath(m_finalBoundariesGeometryFilename))
|
||||
CHECK(base::CopyFileX(m_finalBoundariesGeometryFilename, dumpFilename), ());
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ public:
|
|||
static std::string GetBoundariesFilename(std::string const & filename);
|
||||
|
||||
explicit RoutingCityBoundariesWriter(std::string const & filename);
|
||||
~RoutingCityBoundariesWriter();
|
||||
|
||||
void Process(uint64_t nodeOsmId, LocalityData const & localityData);
|
||||
void Process(uint64_t nodeOsmId, feature::FeatureBuilder const & feature);
|
||||
|
|
Loading…
Add table
Reference in a new issue