[generator] Fix paths for search index builder

This commit is contained in:
Ilya Zverev 2018-01-23 14:20:51 +03:00 committed by Roman Kuznetsov
parent 678b153f41
commit daddaf78a1
2 changed files with 5 additions and 9 deletions

View file

@ -158,6 +158,9 @@ int main(int argc, char ** argv)
std::string const path =
FLAGS_data_path.empty() ? pl.WritableDir() : my::AddSlashIfNeeded(FLAGS_data_path);
// So that stray GetWritablePathForFile calls do not crash the generator.
pl.SetWritableDirForTests(path);
feature::GenerateInfo genInfo;
genInfo.m_intermediateDir = FLAGS_intermediate_data_path.empty() ? path
: my::AddSlashIfNeeded(FLAGS_intermediate_data_path);

View file

@ -396,16 +396,9 @@ bool BuildSearchIndexFromDataFile(string const & filename, bool forceRebuild)
if (readContainer.IsExist(SEARCH_INDEX_FILE_TAG) && !forceRebuild)
return true;
string mwmName = filename;
my::GetNameFromFullPath(mwmName);
my::GetNameWithoutExt(mwmName);
string const indexFilePath = platform.WritablePathForFile(
mwmName + "." SEARCH_INDEX_FILE_TAG EXTENSION_TMP);
string const indexFilePath = filename + "." + SEARCH_INDEX_FILE_TAG EXTENSION_TMP;
string const addrFilePath = filename + "." + SEARCH_ADDRESS_FILE_TAG EXTENSION_TMP;
MY_SCOPE_GUARD(indexFileGuard, bind(&FileWriter::DeleteFileX, indexFilePath));
string const addrFilePath = platform.WritablePathForFile(
mwmName + "." SEARCH_ADDRESS_FILE_TAG EXTENSION_TMP);
MY_SCOPE_GUARD(addrFileGuard, bind(&FileWriter::DeleteFileX, addrFilePath));
try