Fix T38311: cycles BVH cache crash on Windows.
This commit is contained in:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user