From 87dffb425d922d7a12d7104e871eb574abf216aa Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 4 Oct 2016 11:58:51 +0200 Subject: [PATCH] Fixed: Don't check if directory is empty when reinstalling in same directory --- .../client/ryzom_installer/src/installdialog.cpp | 14 +++++++++----- .../client/ryzom_installer/src/migratedialog.cpp | 12 ++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp index 23379bea5..a9af5b82a 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/installdialog.cpp @@ -106,7 +106,7 @@ void CInstallDialog::onAnotherLocationBrowseButtonClicked() 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; @@ -154,7 +154,7 @@ void CInstallDialog::accept() 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; } @@ -186,10 +186,14 @@ void CInstallDialog::accept() 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.")); - return; + if (!isDirectoryEmpty(m_dstDirectory, true)) + { + QMessageBox::StandardButton res = QMessageBox::warning(this, tr("Directory not empty"), tr("This directory is not empty, please choose another one.")); + return; + } } if (oldDirectoryRadioButton->isChecked()) diff --git a/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp index 0395a90dd..0527bca1f 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/migratedialog.cpp @@ -122,7 +122,7 @@ void CMigrateDialog::accept() // compare with exact size of current directory 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; } @@ -154,10 +154,14 @@ void CMigrateDialog::accept() 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.")); - return; + if (!isDirectoryEmpty(m_dstDirectory, true)) + { + 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);