From 31f4957a40d658b8b358f356af521b76f67d47d6 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 18 Oct 2016 20:34:25 +0200 Subject: [PATCH] Fixed: Display a more explicit error if NLMISC::CSystemInfo::availableHDSpace returns 0 --HG-- branch : develop --- .../tools/client/ryzom_installer/src/downloader.cpp | 11 +++++++++++ .../client/ryzom_installer/src/installdialog.cpp | 9 +++++++++ .../client/ryzom_installer/src/migratedialog.cpp | 8 ++++++++ 3 files changed, 28 insertions(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp b/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp index cdd471cf6..eb87a6175 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/downloader.cpp @@ -17,6 +17,7 @@ #include "stdpch.h" #include "operation.h" #include "downloader.h" +#include "utils.h" #include "nel/misc/system_info.h" #include "nel/misc/path.h" @@ -180,6 +181,16 @@ void CDownloader::downloadFile() { qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_fullPath.toUtf8().constData()); + if (freeSpace == 0) + { + if (m_listener) + { + QString error = qFromUtf8(NLMISC::formatErrorMessage(NLMISC::getLastError())); + m_listener->operationFail(tr("Error '%1' occured when trying to check free disk space on %2.").arg(error).arg(m_fullPath)); + } + return; + } + if (freeSpace < m_size - m_offset) { // we have not enough free disk space to continue download diff --git a/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp index 4ec1849a6..65378c369 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp @@ -21,6 +21,7 @@ #include "nel/misc/system_info.h" #include "nel/misc/common.h" +#include "nel/misc/debug.h" #ifdef DEBUG_NEW #define new DEBUG_NEW @@ -131,6 +132,14 @@ void CInstallDialog::accept() // check free disk space qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData()); + if (freeSpace == 0) + { + QString error = qFromUtf8(NLMISC::formatErrorMessage(NLMISC::getLastError())); + + QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Error"), tr("Error '%1' occured when trying to check free disk space on %2.").arg(error).arg(m_dstDirectory)); + return; + } + const CServer &server = CConfigFile::getInstance()->getServer(); if (freeSpace < server.dataUncompressedSize) diff --git a/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp index 92c4da4e6..5f645042a 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp @@ -147,6 +147,14 @@ void CMigrateDialog::accept() // check free disk space qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData()); + if (freeSpace == 0) + { + QString error = qFromUtf8(NLMISC::formatErrorMessage(NLMISC::getLastError())); + + QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Error"), tr("Error '%1' occured when trying to check free disk space on %2.").arg(error).arg(m_dstDirectory)); + return; + } + // compare with exact size of current directory if (freeSpace < getDirectorySize(m_currentDirectory, true)) {