1. 判断文件夹是不是存在

 1 QString fullPath;//文件夹全路径
 2 /*方法1*/
 3 bool isDirExist(QString fullPath)
 4 {
 5     QDir dir(fullPath);
 6     if(dir.exists())
 7     {
 8       return true;
 9     }
10     return false;
11 }
12 /*方法2*/
13 bool isDirExist(QString fullPath)
14 {
15     QFileInfo fileInfo(fullPath);
16     if(fileInfo.isDir())
17     {
18       return true;
19     }
20     return false;
21 }
View Code

相关文章: