From fc55aef503176f1c97b6c35a3ceb3b9a0c148886 Mon Sep 17 00:00:00 2001 From: Sergey Yershov Date: Mon, 25 Jan 2016 12:35:01 +0300 Subject: [PATCH] [Old map downloader] Fix bug with fast migrate --- map/framework.cpp | 11 ++++++++++- storage/storage.cpp | 9 ++------- storage/storage.hpp | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/map/framework.cpp b/map/framework.cpp index b9e03d090a..7dd0503f27 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -529,8 +529,17 @@ void Framework::RegisterAllMaps() m_storage.RegisterAllLocalMaps(); + // Fast migrate if possible. if(platform::migrate::NeedMigrate()) - m_storage.FastMigrateIfPossible(); + { + bool disableFastMigrate = false; + Settings::Get("DisableFastMigrate", disableFastMigrate); + if(!disableFastMigrate && m_storage.HaveDownloadedCountries()) + { + Migrate(); + return; + } + } int minFormat = numeric_limits::max(); diff --git a/storage/storage.cpp b/storage/storage.cpp index a23f5dc326..1955eb8a89 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -106,14 +106,9 @@ void Storage::Clear() m_localFilesForFakeCountries.clear(); } -void Storage::FastMigrateIfPossible() +bool Storage::HaveDownloadedCountries() { - bool disableFastMigrate = false; - Settings::Get("DisableFastMigrate", disableFastMigrate); - if(!disableFastMigrate && platform::migrate::NeedMigrate() && m_localFiles.empty()) - { - Migrate(); - } + return !m_localFiles.empty(); } void Storage::Migrate() diff --git a/storage/storage.hpp b/storage/storage.hpp index ed6fb9ebdd..9f080ac614 100644 --- a/storage/storage.hpp +++ b/storage/storage.hpp @@ -112,7 +112,7 @@ public: /// Switch on new storage version, remove old mwm /// and add required mwm's into download queue. void Migrate(); - void FastMigrateIfPossible(); + bool HaveDownloadedCountries(); void DeleteAllLocalMaps(vector * existedCountries = nullptr); // Clears local files registry and downloader's queue.