1.判断文件夹是否存在,不存在则创建(错误示范)
bool isDirExist(QString fullPath)
{
QDir dir(fullPath);
if(dir.exists())
{
return true;
}
else
{
bool ok = dir.mkpath(fullPath);//创建多级目录
return ok;
}
}
错误代码示范
效果展示
正确代码示范
效果展示