diff --git a/generator/update_generator.cpp b/generator/update_generator.cpp index 59f9e54213..5c049338ca 100644 --- a/generator/update_generator.cpp +++ b/generator/update_generator.cpp @@ -1,9 +1,5 @@ #include "update_generator.hpp" -#include "../coding/file_writer.hpp" - -#include "../geometry/cellid.hpp" - #include "../platform/platform.hpp" #include "../storage/country.hpp" @@ -13,10 +9,9 @@ #include "../base/logging.hpp" #include "../base/macros.hpp" -#include "../std/target_os.hpp" -#include "../std/fstream.hpp" #include "../std/iterator.hpp" + using namespace storage; /// files which can be updated through downloader @@ -54,11 +49,13 @@ namespace update platform.GetFilesInDir(dataDir, gExtensionsToUpdate[i], otherFiles); std::copy(otherFiles.begin(), otherFiles.end(), std::back_inserter(files)); } + { // remove minsk-pass from list Platform::FilesList::iterator minskPassIt = std::find(files.begin(), files.end(), "minsk-pass" DATA_FILE_EXTENSION); if (minskPassIt != files.end()) files.erase(minskPassIt); } + if (files.empty()) { LOG(LERROR, ("Can't find any files at path", dataDir)); @@ -69,48 +66,21 @@ namespace update LOG_SHORT(LINFO, ("Files count included in update file:", files.size())); } - TDataFiles cellFiles; TCommonFiles commonFiles; - string name, ext; - int32_t level = -1; - uint16_t bits; + TDataFiles dataFiles; + for (Platform::FilesList::iterator it = files.begin(); it != files.end(); ++it) { uint64_t size = 0; CHECK( platform.GetFileSize(dataDir + *it, size), ()); CHECK_EQUAL( size, static_cast(size), ("We don't support files > 4gb", *it)); - if (SplitExtension(*it, name, ext)) - { - // is it data cell file? - if (ext == DATA_FILE_EXTENSION) - { - if (CountryCellId::IsCellId(name)) - { - CountryCellId cellId = CountryCellId::FromString(name); - pair bl = cellId.ToBitsAndLevel(); - if (level < 0) - level = bl.second; - CHECK_EQUAL( level, bl.second, ("Data files with different level?", *it) ); - bits = static_cast(bl.first); - CHECK_EQUAL( name, CountryCellId::FromBitsAndLevel(bits, level).ToString(), (name)); - cellFiles.push_back(make_pair(bits, static_cast(size))); - } - else - { - commonFiles.push_back(make_pair(*it, static_cast(size))); - } - } - else - { - commonFiles.push_back(make_pair(*it, static_cast(size))); - } - } + + commonFiles.push_back(make_pair(*it, static_cast(size))); } - SaveTiles(dataDir + DATA_UPDATE_FILE, level, cellFiles, commonFiles); + SaveTiles(dataDir + DATA_UPDATE_FILE, -1, dataFiles, commonFiles); - LOG_SHORT(LINFO, ("Created update file with", cellFiles.size(), "cell data files and", - commonFiles.size(), "other files")); + LOG_SHORT(LINFO, ("Created update file with ", commonFiles.size(), " files")); return true; } diff --git a/storage/country.cpp b/storage/country.cpp index 9158f70bf0..10921ad89e 100644 --- a/storage/country.cpp +++ b/storage/country.cpp @@ -16,7 +16,6 @@ #include "../base/string_utils.hpp" #include "../base/timer.hpp" -#include "../std/fstream.hpp" namespace storage {