From 35ab1567610129b08e5b45387574cbbdcfea256e Mon Sep 17 00:00:00 2001 From: chenzenghui <3045316072@qq.com> Date: Wed, 2 Jul 2025 00:04:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BaseTool/FileOperator.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/BaseTool/FileOperator.cpp b/BaseTool/FileOperator.cpp index 80f670a..3f64f69 100644 --- a/BaseTool/FileOperator.cpp +++ b/BaseTool/FileOperator.cpp @@ -15,6 +15,7 @@ #include #include #include +#include @@ -269,7 +270,12 @@ bool BASECONSTVARIABLEAPI unTarfile(QString inTargzPath, QString outGzFolderPath // tar -zxvf 压缩包路径 文件或目录路径 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.waitForFinished(); // 等待执行完成 // 获取输出