|
@@ -490,6 +490,18 @@ bool DataManager::saveData()
|
|
{
|
|
{
|
|
QJsonObject dataObj;
|
|
QJsonObject dataObj;
|
|
write(dataObj);
|
|
write(dataObj);
|
|
|
|
+ //判断该路径是否存在,若不存在则创建
|
|
|
|
+ QString path = QDir::homePath()+"/Documents/RedInterstitialData/ElemsConf";
|
|
|
|
+ std::cout<<qPrintable(path)<<std::endl;
|
|
|
|
+ QDir *dir = new QDir;
|
|
|
|
+ if(!dir->exists(path)){
|
|
|
|
+ bool ismkdir = dir->mkpath(path);
|
|
|
|
+ if(!ismkdir){
|
|
|
|
+ qDebug() << "create path fail" <<Qt::endl;
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ delete dir;
|
|
QFile file(QDir::homePath() + "/Documents/RedInterstitialData/ElemsConf/data.json");
|
|
QFile file(QDir::homePath() + "/Documents/RedInterstitialData/ElemsConf/data.json");
|
|
if(!file.open(QIODevice::WriteOnly)){
|
|
if(!file.open(QIODevice::WriteOnly)){
|
|
qDebug()<<"file open failed!";
|
|
qDebug()<<"file open failed!";
|