不打包空文件夹

CigaretteSH
Flamingo 9 months ago
parent 1ffc704984
commit 17bb01c5be

@ -345,21 +345,27 @@ void ExportDataThread::run()
QStringList argsNg;
QStringList argsOk;
zipFilePaths.append(g_conf_path.save_pics_path + "/" + "416_BJ_" + zipTimeStamp[0] + "-00_0.zip");
zipFilePaths.append(g_conf_path.save_pics_path + "/" + "416_BJ_" + zipTimeStamp[0] + "-59_1.zip");
zipFilePaths.append(g_conf_path.save_pics_path + "/" + "416_BJ_" + zipTimeStamp[0] + "-00_" + zipTimeStamp[0] + "-59_0.zip");
zipFilePaths.append(g_conf_path.save_pics_path + "/" + "416_BJ_" + zipTimeStamp[0] + "-00_" + zipTimeStamp[0] + "-59_1.zip");
fileList.append(g_conf_path.save_pics_path + "/" + zipTimeStamp[0] + "ng.txt");
fileList.append(g_conf_path.save_pics_path + "/" + zipTimeStamp[0] + "ok.txt");
zipTimeStamp.clear();
QFile fileNg(fileList[0]);
QFile fileOk(fileList[1]);
QFile* file[2] = { NULL };
fileNg.open(QIODevice::WriteOnly);
fileOk.open(QIODevice::WriteOnly);
file[0] = new QFile(fileList[0]);
file[1] = new QFile(fileList[1]);
QTextStream ngStream(&fileNg);
QTextStream okStream(&fileOk);
//QFile fileNg(fileList[0]);
// QFile fileOk(fileList[1]);
file[0]->open(QIODevice::WriteOnly);
file[1]->open(QIODevice::WriteOnly);
QTextStream ngStream(file[0]);
QTextStream okStream(file[1]);
argsNg.append("a");
argsNg.append(zipFilePaths[0]);
@ -378,13 +384,6 @@ void ExportDataThread::run()
ngStream << listToZip[i] << endl;
}
/*
QDir dir;
if (!dir.exists(listToZip[i].mid(index - 1)))
{
dir.mkpath(listToZip[i].mid(index - 1));
}
*/
}
argsNg.append("-i@" + fileList[0]);
argsNg.append("-mx=3");
@ -392,23 +391,26 @@ void ExportDataThread::run()
argsOk.append("-i@" + fileList[1]);
argsOk.append("-mx=3");
fileNg.close();
fileOk.close();
file[0]->close();
file[1]->close();
for (int i = 0; i < zipFilePaths.size(); i++) {
if (file[i]->size() == 0) {
continue;
}
process.start(QApplication::applicationDirPath() + "/7z.exe", i == 0 ? argsNg : argsOk);
process.waitForStarted();
process.waitForFinished();
//QString out = QString::fromLocal8Bit(process.readAllStandardOutput());
//qDebug() << out;
remotePath = zipFilePaths[i].mid(zipFilePaths[i].indexOf("image") - 1);
//qDebug() << remotePath;
qDebug() << remotePath;
ConnectServer(zipFilePaths[i], remotePath);
QFile file(zipFilePaths[i]);
file.remove();
}
fileNg.remove();
fileOk.remove();
file[0]->remove();
file[1]->remove();
listToZip.clear();
readyToSendZip = false;
}

Loading…
Cancel
Save