From 2717fc95041510cf50c2f8920366235c50184b7d Mon Sep 17 00:00:00 2001 From: lordmulder Date: Fri, 16 Dec 2016 20:54:01 +0100 Subject: [PATCH] Adapt for latest MUtils changes. --- src/version.h | 2 +- src/win_updater.cpp | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/version.h b/src/version.h index 6ff0a6b..87bf536 100644 --- a/src/version.h +++ b/src/version.h @@ -26,7 +26,7 @@ #define VER_X264_MAJOR 2 #define VER_X264_MINOR 7 #define VER_X264_PATCH 7 -#define VER_X264_BUILD 1069 +#define VER_X264_BUILD 1070 #define VER_X264_PORTABLE_EDITION (0) diff --git a/src/win_updater.cpp b/src/win_updater.cpp index b2ad7e7..b2210d9 100644 --- a/src/win_updater.cpp +++ b/src/win_updater.cpp @@ -170,17 +170,21 @@ void UpdaterDialog::keyPressEvent(QKeyEvent *event) { if(event->key() == Qt::Key_F11) { - QFile logFile(QString("%1/%2.log").arg(MUtils::temp_folder(), MUtils::rand_str())); - if(logFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) + const QString logFilePath = MUtils::make_temp_file(MUtils::temp_folder(), "log", true); + if (!logFilePath.isEmpty()) { - logFile.write("\xEF\xBB\xBF"); - for(QStringList::ConstIterator iter = m_logFile.constBegin(); iter != m_logFile.constEnd(); iter++) + QFile logFile(logFilePath); + if (logFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - logFile.write(iter->toUtf8()); - logFile.write("\r\n"); + logFile.write("\xEF\xBB\xBF"); + for (QStringList::ConstIterator iter = m_logFile.constBegin(); iter != m_logFile.constEnd(); iter++) + { + logFile.write(iter->toUtf8()); + logFile.write("\r\n"); + } + logFile.close(); + QDesktopServices::openUrl(QUrl::fromLocalFile(logFile.fileName())); } - logFile.close(); - QDesktopServices::openUrl(QUrl::fromLocalFile(logFile.fileName())); } } } @@ -469,13 +473,13 @@ bool UpdaterDialog::checkBinaries(void) { const QString orgName = QString::fromLatin1(BINARIES[i].name); const QString binPath = QString("%1/toolset/common/%2").arg(m_sysinfo->getAppPath(), orgName); - const QString outPath = QString("%1/%2_%3.%4").arg(tempPath, QFileInfo(orgName).baseName(), MUtils::rand_str(), QFileInfo(orgName).suffix()); + const QString outPath = MUtils::make_unique_file(tempPath, QFileInfo(orgName).baseName(), QFileInfo(orgName).suffix()); if(!checkFileHash(binPath, BINARIES[i].hash)) { qWarning("Verification of '%s' has failed!", MUTILS_UTF8(orgName)); return false; } - if(!QFile::copy(binPath, outPath)) + if(outPath.isEmpty() || (!QFile::copy(binPath, outPath))) { qWarning("Copying of '%s' has failed!", MUTILS_UTF8(orgName)); return false;