mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-22 15:16:12 +00:00
Merged in Glorf/ryzomcore/fix_freespace_check (pull request #156)
Fix ignoreFreeDiskSpaceChecks() usage Approved-by: Cédric OCHS <kervala@gmail.com> --HG-- branch : develop
This commit is contained in:
commit
36f5ee7f83
2 changed files with 8 additions and 6 deletions
|
@ -180,9 +180,10 @@ void CDownloader::getFileHead()
|
||||||
|
|
||||||
void CDownloader::downloadFile()
|
void CDownloader::downloadFile()
|
||||||
{
|
{
|
||||||
qint64 freeSpace = CConfigFile::getInstance()->ignoreFreeDiskSpaceChecks() ? 0:NLMISC::CSystemInfo::availableHDSpace(m_fullPath.toUtf8().constData());
|
bool ignoreFreeDiskSpaceChecks = CConfigFile::getInstance()->ignoreFreeDiskSpaceChecks();
|
||||||
|
qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_fullPath.toUtf8().constData());
|
||||||
|
|
||||||
if (freeSpace == 0)
|
if (!ignoreFreeDiskSpaceChecks && freeSpace == 0)
|
||||||
{
|
{
|
||||||
if (m_listener)
|
if (m_listener)
|
||||||
{
|
{
|
||||||
|
@ -192,7 +193,7 @@ void CDownloader::downloadFile()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (freeSpace < m_size - m_offset)
|
if (!ignoreFreeDiskSpaceChecks && 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
|
||||||
if (m_listener) m_listener->operationFail(tr("You only have %1 bytes left on the device, but %2 bytes are needed.").arg(freeSpace).arg(m_size - m_offset));
|
if (m_listener) m_listener->operationFail(tr("You only have %1 bytes left on the device, but %2 bytes are needed.").arg(freeSpace).arg(m_size - m_offset));
|
||||||
|
|
|
@ -123,10 +123,11 @@ void CMigrateDialog::updateDestinationText()
|
||||||
void CMigrateDialog::accept()
|
void CMigrateDialog::accept()
|
||||||
{
|
{
|
||||||
// check free disk space
|
// check free disk space
|
||||||
qint64 freeSpace = CConfigFile::getInstance()->ignoreFreeDiskSpaceChecks() ? 0:NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData());
|
bool ignoreFreeDiskSpaceChecks = CConfigFile::getInstance()->ignoreFreeDiskSpaceChecks();
|
||||||
|
qint64 freeSpace = NLMISC::CSystemInfo::availableHDSpace(m_dstDirectory.toUtf8().constData());
|
||||||
|
|
||||||
// shouldn't happen
|
// shouldn't happen
|
||||||
if (freeSpace == 0)
|
if (!ignoreFreeDiskSpaceChecks && freeSpace == 0)
|
||||||
{
|
{
|
||||||
int error = NLMISC::getLastError();
|
int error = NLMISC::getLastError();
|
||||||
|
|
||||||
|
@ -134,7 +135,7 @@ void CMigrateDialog::accept()
|
||||||
}
|
}
|
||||||
|
|
||||||
// compare with exact size of current directory
|
// compare with exact size of current directory
|
||||||
if (freeSpace && freeSpace < getDirectorySize(m_currentDirectory, true))
|
if (!ignoreFreeDiskSpaceChecks && freeSpace && freeSpace < getDirectorySize(m_currentDirectory, true))
|
||||||
{
|
{
|
||||||
QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Not enough free disk space"), tr("You don't have enough free space on this disk, please make more space or choose a directory on another disk."));
|
QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Not enough free disk space"), tr("You don't have enough free space on this disk, please make more space or choose a directory on another disk."));
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue