diff options
author | Maksim Andrianov <maksimandrianov1@gmail.com> | 2020-12-01 12:32:16 +0300 |
---|---|---|
committer | Tatiana Yan <tatiana.kondakova@gmail.com> | 2020-12-18 17:52:12 +0300 |
commit | 81cbc6c1de622689fc8e22981db4c404b7afb9e8 (patch) | |
tree | ecfb8d99a7152bf3e9f21aee5fb0b60349aa1615 /generator | |
parent | c10dffc2f14b447345206237562b892860cb772c (diff) |
[generator] Fixed removing temporary files.
Diffstat (limited to 'generator')
-rw-r--r-- | generator/collector_interface.hpp | 2 | ||||
-rw-r--r-- | generator/collector_routing_city_boundaries.cpp | 14 | ||||
-rw-r--r-- | generator/collector_routing_city_boundaries.hpp | 1 |
3 files changed, 13 insertions, 4 deletions
diff --git a/generator/collector_interface.hpp b/generator/collector_interface.hpp index 5434687300..1f914f8cce 100644 --- a/generator/collector_interface.hpp +++ b/generator/collector_interface.hpp @@ -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; diff --git a/generator/collector_routing_city_boundaries.cpp b/generator/collector_routing_city_boundaries.cpp index 3404d00e8f..3d8a272708 100644 --- a/generator/collector_routing_city_boundaries.cpp +++ b/generator/collector_routing_city_boundaries.cpp @@ -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), ()); } diff --git a/generator/collector_routing_city_boundaries.hpp b/generator/collector_routing_city_boundaries.hpp index 1a516d608c..c09c7f644f 100644 --- a/generator/collector_routing_city_boundaries.hpp +++ b/generator/collector_routing_city_boundaries.hpp @@ -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); |