#qt 一.判断文件是否存在 ``` cpp QString filePath = "填写你要判断的文件路径"; QFile file(filePath); if(file.exists()) { qDebug()<<"文件存在"; } else { qDebug()<<"文件不存在"; } ``` 二.判断文件夹是否存在 ``` cpp QString dirPath = "填写你要判断的目录路径"; QDir dir(dirPath); if(dir.exists()) { qDebug()<<"目录存在"; } else { qDebug()<<"目录不存在"; } ```