mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-22 23:26:15 +00:00
Fixed: Display a more explicit error if NLMISC::CSystemInfo::availableHDSpace returns 0
--HG-- branch : develop
This commit is contained in:
parent
daf3edd056
commit
31f4957a40
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