diff options
author | vng <viktor.govako@gmail.com> | 2012-10-30 17:26:11 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:46:28 +0300 |
commit | b90719b6cb1b5f09fd047ff61fe93003cbabb360 (patch) | |
tree | 48aff2a18a2cc86ce655ee170fceaf62823ec40b /storage | |
parent | 77564c5b7a3c2448a0fb7d46d1104a756eaeaf27 (diff) |
Delete old "downloading" and "resume" files when Storage is initializing.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/storage.cpp | 12 |
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]); } //////////////////////////////////////////////////////////////////////////// |