Fixed: Display a more explicit error if NLMISC::CSystemInfo::availableHDSpace returns 0

--HG--
branch : develop
This commit is contained in:
kervala 2016-10-18 20:34:25 +02:00
parent daf3edd056
commit 31f4957a40
3 changed files with 28 additions and 0 deletions

View file

@ -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

View file

@ -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)

View file

@ -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))
{