Fixed: Don't check if directory is empty when reinstalling in same directory

This commit is contained in:
kervala 2016-10-04 11:58:51 +02:00
parent 1b8e007ce3
commit bd8e3d3b0a
2 changed files with 17 additions and 9 deletions

View file

@ -106,7 +106,7 @@ void CInstallDialog::onAnotherLocationBrowseButtonClicked()
if (CConfigFile::getInstance()->isRyzomInstalledIn(directory)) break; if (CConfigFile::getInstance()->isRyzomInstalledIn(directory)) break;
QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Unable to find Ryzom"), tr("Unable to find Ryzom in selected directory. Please choose another one or cancel.")); QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Unable to find Ryzom"), tr("Unable to find Ryzom in selected directory. Please choose another one or cancel."));
} }
m_anotherDirectory = directory; m_anotherDirectory = directory;
@ -154,7 +154,7 @@ void CInstallDialog::accept()
if (freeSpace < server.dataUncompressedSize) if (freeSpace < server.dataUncompressedSize)
{ {
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;
} }
@ -186,10 +186,14 @@ void CInstallDialog::accept()
return; return;
} }
if (!isDirectoryEmpty(m_dstDirectory, true)) // if reinstalling in same directory, don't check if directory is empty
if (m_dstDirectory != CConfigFile::getInstance()->getNewInstallationDirectory())
{ {
QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Directory not empty"), tr("This directory is not empty, please choose another one.")); if (!isDirectoryEmpty(m_dstDirectory, true))
return; {
QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Directory not empty"), tr("This directory is not empty, please choose another one."));
return;
}
} }
if (oldDirectoryRadioButton->isChecked()) if (oldDirectoryRadioButton->isChecked())

View file

@ -122,7 +122,7 @@ void CMigrateDialog::accept()
// 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))
{ {
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;
} }
@ -154,10 +154,14 @@ void CMigrateDialog::accept()
return; return;
} }
if (!isDirectoryEmpty(m_dstDirectory, true)) // if reinstalling in same directory, don't check if directory is empty
if (m_dstDirectory != CConfigFile::getInstance()->getNewInstallationDirectory())
{ {
QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Directory not empty"), tr("This directory is not empty, please choose another one.")); if (!isDirectoryEmpty(m_dstDirectory, true))
return; {
QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Directory not empty"), tr("This directory is not empty, please choose another one."));
return;
}
} }
CConfigFile::getInstance()->setSrcServerDirectory(m_currentDirectory); CConfigFile::getInstance()->setSrcServerDirectory(m_currentDirectory);