1. 错误控制;

2. 创建配置文件的文件夹;
This commit is contained in:
tangchao0503
2023-04-10 15:54:57 +08:00
parent b31cd5fc8a
commit 371c422a34
5 changed files with 54 additions and 16 deletions

View File

@ -88,3 +88,36 @@ void swap(unsigned short * a, unsigned short * b)
*a=*b;
*b=tmp;
}
bool createDir(QString fullPath)
{
QDir dir(fullPath);
if (dir.exists()) {
return true;
} else {
bool ok = dir.mkpath(fullPath);//创建多级目录
return ok;
}
}
QList<QString> getFileInfo(QString file)
{
QFileInfo fileInfo = QFileInfo(file);
QString fileName, fileSuffix, filePath;
filePath = fileInfo.absolutePath();//绝对路径
fileName = fileInfo.fileName();//文件名
fileSuffix = fileInfo.suffix();//文件后缀
// qDebug() << fileName <<endl
// << fileSuffix<< endl
// << filePath<< endl;
QList<QString> result;
result.append(filePath);
result.append(fileName);
result.append(fileSuffix);
return result;
}