[platform] Do not add/register maps newer than App.

This commit is contained in:
Yuri Gorshenin 2015-11-19 16:44:05 +03:00
parent 37da72a3c0
commit 7c18e96b4f
4 changed files with 11 additions and 5 deletions

View file

@ -198,7 +198,7 @@ void FindAllLocalMapsAndCleanup(int64_t latestVersion, vector<LocalCountryFile>
{
string const & subdir = fwt.first;
int64_t version;
if (!ParseVersion(subdir, version))
if (!ParseVersion(subdir, version) || version > latestVersion)
continue;
string const fullPath = my::JoinFoldersToPath(dir, subdir);

View file

@ -159,7 +159,7 @@ UNIT_TEST(LocalCountryFile_CleanupMapFiles)
// Check FindAllLocalMaps()
vector<LocalCountryFile> localFiles;
FindAllLocalMapsAndCleanup(-1 /* latestVersion */, localFiles);
FindAllLocalMapsAndCleanup(4 /* latestVersion */, localFiles);
TEST(!Contains(localFiles, japanLocalFile), (japanLocalFile, localFiles));
TEST(!Contains(localFiles, brazilLocalFile), (brazilLocalFile, localFiles));
TEST(Contains(localFiles, irelandLocalFile), (irelandLocalFile, localFiles));
@ -270,7 +270,7 @@ UNIT_TEST(LocalCountryFile_AllLocalFilesLookup)
ScopedFile testItalyMapFile(testDir, italyFile, MapOptions::Map, "Italy-map");
vector<LocalCountryFile> localFiles;
FindAllLocalMapsAndCleanup(-1 /* latestVersion */, localFiles);
FindAllLocalMapsAndCleanup(10101 /* latestVersion */, localFiles);
multiset<LocalCountryFile> localFilesSet(localFiles.begin(), localFiles.end());
bool worldFound = false;

View file

@ -10,6 +10,8 @@
#include "base/logging.hpp"
#include "std/limits.hpp"
using namespace routing;
namespace
@ -18,7 +20,8 @@ UNIT_TEST(CheckCrossSections)
{
static double constexpr kPointEquality = 0.01;
vector<platform::LocalCountryFile> localFiles;
platform::FindAllLocalMapsAndCleanup(-1 /* latestVersion */, localFiles);
platform::FindAllLocalMapsAndCleanup(numeric_limits<int64_t>::max() /* latestVersion */,
localFiles);
size_t ingoingErrors = 0;
size_t outgoingErrors = 0;

View file

@ -24,6 +24,8 @@
#include "geometry/distance_on_sphere.hpp"
#include "std/limits.hpp"
#include "private.h"
#include <sys/resource.h>
@ -159,7 +161,8 @@ namespace integration
pl.SetResourceDir(options.m_resourcePath);
vector<LocalCountryFile> localFiles;
platform::FindAllLocalMapsAndCleanup(-1, localFiles);
platform::FindAllLocalMapsAndCleanup(numeric_limits<int64_t>::max() /* latestVersion */,
localFiles);
for (auto & file : localFiles)
file.SyncWithDisk();
ASSERT(!localFiles.empty(), ());