现在有多个文件,路径为:
a\xxx\kmd_config\c.json
其中xxx是变量
startcalc,,,,,,
目标:
访问每一个json文件
实例:
QString app_path = QApplication::applicationDirPath() + "/app";
QDir dir(app_path);
QStringList list=dir.entryList(QDir::NoDotAndDotDot|QDir::Dirs);
for(int i=0;i<list.count();++i)
{
QString config_path=app_path+"/"+list.at(i)+"/kmd_config/config.json";
qDebug()<<config_path;
}
参考:QT递归搜索文件(entryList)-CSDN博客