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(); // 等待执行完成 // 获取输出