|
@@ -65,11 +65,12 @@ bool FileUtil::copyFileToPath(QString sourceDir, QString toDir, bool coverFileIf
|
|
|
if (!QFile::exists(sourceDir)) {
|
|
|
return false;
|
|
|
}
|
|
|
- QDir *createfile = new QDir;
|
|
|
- bool exist = createfile->exists(toDir);
|
|
|
+ QDir createfile;
|
|
|
+ bool exist = createfile.exists(toDir);
|
|
|
if (exist) {
|
|
|
if (coverFileIfExist) {
|
|
|
- createfile->remove(toDir);
|
|
|
+ createfile.remove(toDir);
|
|
|
+ // createfile.mkdir(toDir);
|
|
|
}
|
|
|
|
|
|
} // end if
|
|
@@ -84,16 +85,13 @@ bool FileUtil::importEngineerFile()
|
|
|
{
|
|
|
QFileDialog::Options options;
|
|
|
options |= QFileDialog::DontUseNativeDialog;
|
|
|
-
|
|
|
- QString srcDirPath = QFileDialog::getExistingDirectory(nullptr, "导入资源包", "/", options);
|
|
|
- qDebug() << "importEngineerFile-------" << srcDirPath;
|
|
|
- if (srcDirPath.isEmpty() || srcDirPath.size() <= 0) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- QSettings config("config.ini", QSettings::IniFormat);
|
|
|
- config.setIniCodec("UTF-8");
|
|
|
+ QString fileName = QFileDialog::getOpenFileName(nullptr, "导入资源包", "/", "");
|
|
|
+ qDebug() << "fileName-------" << fileName;
|
|
|
QString sysDbPath = QCoreApplication::applicationDirPath();
|
|
|
- sysDbPath += config.value("USERCONFIG/DbPath", "").toString();
|
|
|
- bool result = FileUtil().copyDirectoryFiles(sysDbPath, srcDirPath, true);
|
|
|
+ sysDbPath += "/importData/exportData.ini";
|
|
|
+ qDebug() << "sysDbPath-------" << sysDbPath;
|
|
|
+ qDebug() << "fileName-------" << fileName;
|
|
|
+ bool result = FileUtil().copyFileToPath(fileName, sysDbPath, true);
|
|
|
+ qDebug() << "result-------" << result;
|
|
|
return result;
|
|
|
}
|