Fixed asserts with empty dir

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk 2022-03-13 23:23:22 +01:00 committed by Viktor Govako
parent 860ab1d940
commit 94e45ce625
6 changed files with 9 additions and 2 deletions

View file

@ -101,6 +101,7 @@ public:
GenerateInfo genInfo;
// Generate intermediate data.
genInfo.m_cacheDir = writableDir;
genInfo.m_intermediateDir = writableDir;
genInfo.m_nodeStorageType = feature::GenerateInfo::NodeStorageType::Index;
genInfo.m_osmFileName = base::JoinPath(writableDir, osmRelativePath);

View file

@ -172,6 +172,7 @@ void TestSpeedCameraSectionBuilding(string const & osmContent, CameraMap const &
GenerateInfo genInfo;
genInfo.m_fileName = kTestMwm;
genInfo.m_bucketNames.push_back(kTestMwm);
genInfo.m_cacheDir = testDirFullPath;
genInfo.m_tmpDir = testDirFullPath;
genInfo.m_targetDir = testDirFullPath;
genInfo.m_intermediateDir = testDirFullPath;

View file

@ -136,6 +136,7 @@ void TestMwmBuilder::Finish()
GenerateInfo info;
info.m_targetDir = m_file.GetDirectory();
info.m_tmpDir = m_file.GetDirectory();
info.m_intermediateDir = m_file.GetDirectory();
info.m_versionDate = static_cast<uint32_t>(base::YYMMDDToSecondsSinceEpoch(m_version));
CHECK(GenerateFinalFeatures(info, m_file.GetCountryFile().GetName(), m_type),
("Can't sort features."));

View file

@ -28,6 +28,10 @@ LocalCountryFile::LocalCountryFile(string const & directory, CountryFile const &
void LocalCountryFile::SyncWithDisk()
{
// World files from resources have an empty directory. See todo in the header.
if (m_directory.empty())
return;
m_files = {};
uint64_t size = 0;

View file

@ -321,7 +321,7 @@ bool Platform::MkDirChecked(string const & dirName)
bool Platform::MkDirRecursively(string const & dirName)
{
string::value_type const sep[] = { base::GetNativeSeparator(), 0};
string path = strings::StartsWith(dirName, sep) ? sep : "";
string path = strings::StartsWith(dirName, sep) ? sep : ".";
auto const tokens = strings::Tokenize(dirName, sep);
for (auto const & t : tokens)
{

View file

@ -249,7 +249,7 @@ void Storage::RegisterAllLocalMaps(bool enableDiffs)
if (IsLeaf(countryId))
RegisterCountryFiles(countryId, localFile.GetDirectory(), localFile.GetVersion());
else
RegisterFakeCountryFiles(localFile);
RegisterFakeCountryFiles(localFile); // Also called for Worlds from resources.
LOG(LINFO, ("Found file:", name, "in directory:", localFile.GetDirectory()));