初始化工程提交

master
chenzenghui 2025-07-02 00:04:42 +08:00
parent e57fea3299
commit 35ab156761
1 changed files with 7 additions and 1 deletions

View File

@ -15,6 +15,7 @@
#include <QDirIterator> #include <QDirIterator>
#include <QProcess> #include <QProcess>
#include <QFileInfoList> #include <QFileInfoList>
#include <QCoreApplication>
@ -269,7 +270,12 @@ bool BASECONSTVARIABLEAPI unTarfile(QString inTargzPath, QString outGzFolderPath
// tar -zxvf 压缩包路径 文件或目录路径 // tar -zxvf 压缩包路径 文件或目录路径
QProcess process; QProcess process;
// 同步执行(阻塞当前线程) // 同步执行(阻塞当前线程)
QString cmdstr = QString("WinRAR.exe e %1 %2").arg(inTargzPath).arg(outGzFolderPath); QString applicationPath = QCoreApplication::applicationDirPath();
if (!QFile::exists(applicationPath + "/WinRAR.exe")) {
qDebug() << "WinRAR.exe not found in application directory: " << applicationPath;
return false;
}
QString cmdstr = QString("%1/WinRAR.exe x -r -o+ %2 %3").arg(applicationPath).arg(inTargzPath).arg(outGzFolderPath);
process.execute("cmd.exe", QStringList() << "/c" << cmdstr); // "/c" 表示执行后关闭 CMD process.execute("cmd.exe", QStringList() << "/c" << cmdstr); // "/c" 表示执行后关闭 CMD
process.waitForFinished(); // 等待执行完成 process.waitForFinished(); // 等待执行完成
// 获取输出 // 获取输出