Fixed: Display a more explicit error if NLMISC::CSystemInfo::availableHDSpace returns 0
This commit is contained in:
parent
34a3f05b98
commit
8837ac7831
3 changed files with 28 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
||||||
#include "stdpch.h"
|
#include "stdpch.h"
|
||||||
#include "operation.h"
|
#include "operation.h"
|
||||||
#include "downloader.h"
|
#include "downloader.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include "nel/misc/system_info.h"
|
#include "nel/misc/system_info.h"
|
||||||
#include "nel/misc/path.h"
|
#include "nel/misc/path.h"
|
||||||
|
@ -180,6 +181,16 @@ void CDownloader::downloadFile()
|
||||||
{
|
{
|
||||||
qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_fullPath.toUtf8().constData());
|
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)
|
if (freeSpace < m_size - m_offset)
|
||||||
{
|
{
|
||||||
// we have not enough free disk space to continue download
|
// we have not enough free disk space to continue download
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "nel/misc/system_info.h"
|
#include "nel/misc/system_info.h"
|
||||||
#include "nel/misc/common.h"
|
#include "nel/misc/common.h"
|
||||||
|
#include "nel/misc/debug.h"
|
||||||
|
|
||||||
#ifdef DEBUG_NEW
|
#ifdef DEBUG_NEW
|
||||||
#define new DEBUG_NEW
|
#define new DEBUG_NEW
|
||||||
|
@ -131,6 +132,14 @@ void CInstallDialog::accept()
|
||||||
// check free disk space
|
// check free disk space
|
||||||
qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData());
|
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();
|
const CServer &server = CConfigFile::getInstance()->getServer();
|
||||||
|
|
||||||
if (freeSpace < server.dataUncompressedSize)
|
if (freeSpace < server.dataUncompressedSize)
|
||||||
|
|
|
@ -147,6 +147,14 @@ void CMigrateDialog::accept()
|
||||||
// check free disk space
|
// check free disk space
|
||||||
qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData());
|
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
|
// compare with exact size of current directory
|
||||||
if (freeSpace < getDirectorySize(m_currentDirectory, true))
|
if (freeSpace < getDirectorySize(m_currentDirectory, true))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue