mirror of https://github.com/OpenRCT2/OpenRCT2.git
Do not show file index error if it doesn't exist
This commit is contained in:
parent
3c29b15de9
commit
0f00659c8e
|
@ -196,7 +196,6 @@ private:
|
|||
items.push_back(std::get<1>(item));
|
||||
}
|
||||
}
|
||||
Console::WriteLine();
|
||||
|
||||
WriteIndexFile(scanResult.Stats, items);
|
||||
|
||||
|
@ -210,41 +209,44 @@ private:
|
|||
{
|
||||
bool loadedItems = false;
|
||||
std::vector<TItem> items;
|
||||
try
|
||||
if (File::Exists(_indexPath))
|
||||
{
|
||||
log_verbose("FileIndex:Loading index: '%s'", _indexPath.c_str());
|
||||
auto fs = FileStream(_indexPath, FILE_MODE_OPEN);
|
||||
try
|
||||
{
|
||||
log_verbose("FileIndex:Loading index: '%s'", _indexPath.c_str());
|
||||
auto fs = FileStream(_indexPath, FILE_MODE_OPEN);
|
||||
|
||||
// Read header, check if we need to re-scan
|
||||
auto header = fs.ReadValue<FileIndexHeader>();
|
||||
if (header.HeaderSize == sizeof(FileIndexHeader) &&
|
||||
header.MagicNumber == _magicNumber &&
|
||||
header.VersionA == FILE_INDEX_VERSION &&
|
||||
header.VersionB == _version &&
|
||||
header.LanguageId == gCurrentLanguage &&
|
||||
header.Stats.TotalFiles == stats.TotalFiles &&
|
||||
header.Stats.TotalFileSize == stats.TotalFileSize &&
|
||||
header.Stats.FileDateModifiedChecksum == stats.FileDateModifiedChecksum &&
|
||||
header.Stats.PathChecksum == stats.PathChecksum)
|
||||
{
|
||||
// Directory is the same, just read the saved items
|
||||
for (uint32 i = 0; i < header.NumItems; i++)
|
||||
// Read header, check if we need to re-scan
|
||||
auto header = fs.ReadValue<FileIndexHeader>();
|
||||
if (header.HeaderSize == sizeof(FileIndexHeader) &&
|
||||
header.MagicNumber == _magicNumber &&
|
||||
header.VersionA == FILE_INDEX_VERSION &&
|
||||
header.VersionB == _version &&
|
||||
header.LanguageId == gCurrentLanguage &&
|
||||
header.Stats.TotalFiles == stats.TotalFiles &&
|
||||
header.Stats.TotalFileSize == stats.TotalFileSize &&
|
||||
header.Stats.FileDateModifiedChecksum == stats.FileDateModifiedChecksum &&
|
||||
header.Stats.PathChecksum == stats.PathChecksum)
|
||||
{
|
||||
auto item = Deserialise(&fs);
|
||||
items.push_back(item);
|
||||
// Directory is the same, just read the saved items
|
||||
for (uint32 i = 0; i < header.NumItems; i++)
|
||||
{
|
||||
auto item = Deserialise(&fs);
|
||||
items.push_back(item);
|
||||
}
|
||||
loadedItems = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console::WriteLine("%s out of date", _name.c_str());
|
||||
}
|
||||
loadedItems = true;
|
||||
}
|
||||
else
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
Console::WriteLine("%s out of date", _name.c_str());
|
||||
Console::Error::WriteLine("Unable to load index: '%s'.", _indexPath.c_str());
|
||||
Console::Error::WriteLine("%s", e.what());
|
||||
}
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
Console::Error::WriteLine("Unable to load index: '%s'.", _indexPath.c_str());
|
||||
Console::Error::WriteLine("%s", e.what());
|
||||
}
|
||||
return std::make_tuple(loadedItems, items);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue