1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +00:00

Ignore invalid shader cache index (Bug #1664)

This commit is contained in:
scrawl 2014-07-26 22:24:05 +02:00
parent 8c81e22f3e
commit d7acb7fc7d

View File

@ -51,24 +51,32 @@ namespace sh
{
assert(mCurrentLanguage != Language_None);
if (boost::filesystem::exists (mPlatform->getCacheFolder () + "/lastModified.txt"))
try
{
std::ifstream file;
file.open(std::string(mPlatform->getCacheFolder () + "/lastModified.txt").c_str());
std::string line;
while (getline(file, line))
if (boost::filesystem::exists (mPlatform->getCacheFolder () + "/lastModified.txt"))
{
std::string sourceFile = line;
std::ifstream file;
file.open(std::string(mPlatform->getCacheFolder () + "/lastModified.txt").c_str());
if (!getline(file, line))
assert(0);
std::string line;
while (getline(file, line))
{
std::string sourceFile = line;
int modified = boost::lexical_cast<int>(line);
if (!getline(file, line))
assert(0);
mShadersLastModified[sourceFile] = modified;
int modified = boost::lexical_cast<int>(line);
mShadersLastModified[sourceFile] = modified;
}
}
}
catch (std::exception& e)
{
std::cerr << "Failed to load shader modification index: " << e.what() << std::endl;
mShadersLastModified.clear();
}
// load configurations
{