Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArsentiy Milchakov <milcars@mapswithme.com>2017-11-01 15:36:24 +0300
committerYuri Gorshenin <mipt.vi002@gmail.com>2017-11-01 17:38:12 +0300
commit75423c65dcf3a6c8634e74e4b664c772153f4a74 (patch)
treeb139d1ef22c669f8801be152b1021752c3f5b34c
parent7a1d96bd904fa7aba315d618b348fa0fc2d63397 (diff)
[storage] remove outdated diff files
-rw-r--r--platform/local_country_file_utils.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/platform/local_country_file_utils.cpp b/platform/local_country_file_utils.cpp
index 72d718230f..c71990b408 100644
--- a/platform/local_country_file_utils.cpp
+++ b/platform/local_country_file_utils.cpp
@@ -74,6 +74,12 @@ bool IsDownloaderFile(string const & name)
return regex_match(name.begin(), name.end(), filter);
}
+bool IsDiffFile(string const & name)
+{
+ return strings::EndsWith(name, DIFF_FILE_EXTENSION) ||
+ strings::EndsWith(name, DIFF_APPLYING_FILE_EXTENSION);
+}
+
bool DirectoryHasIndexesOnly(string const & directory)
{
Platform::TFilesWithType fwts;
@@ -168,8 +174,8 @@ void FindAllLocalMapsInDirectoryAndCleanup(string const & directory, int64_t ver
string name = fwt.first;
- // Remove downloader files for old version directories.
- if (IsDownloaderFile(name) && version < latestVersion)
+ // Remove downloader and diff files for old version directories.
+ if (version < latestVersion && (IsDownloaderFile(name) || IsDiffFile(name)))
{
my::DeleteFileX(my::JoinFoldersToPath(directory, name));
continue;