diff options
author | vng <viktor.govako@gmail.com> | 2012-10-31 18:14:41 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:46:30 +0300 |
commit | 95a6cf8b7ae1beb1168c957d28b93d1d78eb6b0b (patch) | |
tree | 2fb221a9fbcc8858e77005f2fff17414c197dc3c /storage | |
parent | 93f9610292ef0baadb7afd58465112c5d7968665 (diff) |
Delete old download temporary files once on a first launch.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/storage.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/storage/storage.cpp b/storage/storage.cpp index d47803f0a2..c2a1b6dec3 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -8,6 +8,7 @@ #include "../platform/platform.hpp" #include "../platform/servers_list.hpp" #include "../platform/file_name_utils.hpp" +#include "../platform/settings.hpp" #include "../coding/file_writer.hpp" #include "../coding/file_reader.hpp" @@ -65,17 +66,20 @@ namespace storage { LoadCountriesFile(false); - Platform & pl = GetPlatform(); - string const dir = pl.WritableDir(); + if (Settings::IsFirstLaunchForDate(121031)) + { + 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?$)"; + // 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); + Platform::FilesList files; + pl.GetFilesByRegExp(dir, regexp, files); - for (size_t j = 0; j < files.size(); ++j) - FileWriter::DeleteFileX(dir + files[j]); + for (size_t j = 0; j < files.size(); ++j) + FileWriter::DeleteFileX(dir + files[j]); + } } //////////////////////////////////////////////////////////////////////////// |