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:
authorvng <viktor.govako@gmail.com>2012-10-30 17:26:11 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:46:28 +0300
commitb90719b6cb1b5f09fd047ff61fe93003cbabb360 (patch)
tree48aff2a18a2cc86ce655ee170fceaf62823ec40b /storage
parent77564c5b7a3c2448a0fb7d46d1104a756eaeaf27 (diff)
Delete old "downloading" and "resume" files when Storage is initializing.
Diffstat (limited to 'storage')
-rw-r--r--storage/storage.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/storage/storage.cpp b/storage/storage.cpp
index 674953770a..d47803f0a2 100644
--- a/storage/storage.cpp
+++ b/storage/storage.cpp
@@ -64,6 +64,18 @@ namespace storage
Storage::Storage() : m_currentSlotId(0)
{
LoadCountriesFile(false);
+
+ Platform & pl = GetPlatform();
+ string const dir = pl.WritableDir();
+
+ // Delete all: .mwm.downloading; .mwm.downloading2; .mwm.resume; .mwm.resume2
+ string const regexp = "\\" DATA_FILE_EXTENSION "\\.(downloading2?$|resume2?$)";
+
+ Platform::FilesList files;
+ pl.GetFilesByRegExp(dir, regexp, files);
+
+ for (size_t j = 0; j < files.size(); ++j)
+ FileWriter::DeleteFileX(dir + files[j]);
}
////////////////////////////////////////////////////////////////////////////