Fix T38311: cycles BVH cache crash on Windows.

This commit is contained in:
Brecht Van Lommel
2014-01-23 01:13:09 +01:00
parent 282ad434a8
commit 4b820fb673
3 changed files with 37 additions and 21 deletions

View File

@@ -264,5 +264,27 @@ FILE *path_fopen(const string& path, const string& mode)
#endif
}
void path_cache_clear_except(const string& name, const set<string>& except)
{
string dir = path_user_get("cache");
if(boost::filesystem::exists(dir)) {
boost::filesystem::directory_iterator it(dir), it_end;
for(; it != it_end; it++) {
#if (BOOST_FILESYSTEM_VERSION == 2)
string filename = from_boost(it->path().filename());
#else
string filename = from_boost(it->path().filename().string());
#endif
if(boost::starts_with(filename, name))
if(except.find(filename) == except.end())
boost::filesystem::remove(to_boost(filename));
}
}
}
CCL_NAMESPACE_END