如果给boost::filesystem::path传入的字符串,没有判断该path的类型,就生成boost::filesystem::directory_iterator就会抛出该异常
假定字符串pPath为文件,下面代码产生异常
path pathDir(pPath);
directory_iterator itrItem(pathDir);
将其修正为:
path pathDir(pPath);
if (is_directory(pathDir))
{
directory_iterator itrItem(pathDir);
}