fix: handle boost error while recursive directory iteration

handle boostrecursive directory search error
ption>
This commit is contained in:
Andreas Stallinger
2016-04-14 16:38:46 +02:00
parent 73ee3a27d9
commit 637cbf88ac
+7 -2
View File
@@ -73,15 +73,20 @@ std::vector<FileInfo> FileSystem::getFileInfosFromPaths(
{
boost::filesystem::recursive_directory_iterator it(path.path());
boost::filesystem::recursive_directory_iterator endit;
while (it != endit)
boost::system::error_code ec;
for ( ; it != endit ; it.increment(ec) )
{
if (ec)
{
it.pop();
continue;
}
if (boost::filesystem::is_regular_file(*it) && hasExtension(it->path().string(), fileExtensions))
{
std::time_t t = boost::filesystem::last_write_time(*it);
boost::posix_time::ptime lastWriteTime = boost::posix_time::from_time_t(t);
files.push_back(FileInfo(it->path(), lastWriteTime));
}
++it;
}
}
else if (path.exists() && path.hasExtension(fileExtensions))