1. 曾遇到C++14不支持std::filesystem, 尝试在cmake里增加同时对C++17的支持,未成功,最后将std::filesystem改为boost::filesystem即可。
2. 文件夹路径被一个进程正在访问和写入,再起一个进程删除话程序就会闪退,解决办法就是增加try catch机制
if(!boost::filesystem::remove_all(dir))
boost::filesystem的try catch
try
{
//代码段
}
catch(const boost::filesystem::filesystem_error &e) {
//代码段
}