From 75423c65dcf3a6c8634e74e4b664c772153f4a74 Mon Sep 17 00:00:00 2001 From: Arsentiy Milchakov Date: Wed, 1 Nov 2017 15:36:24 +0300 Subject: [storage] remove outdated diff files --- platform/local_country_file_utils.cpp | 10 ++++++++-- 1 file 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; -- cgit v1.2.3