Android: don't delete the openssl dir when cloning

Avoid removing the openssl dir if the selected path already exist
and is not empty, rather just recommend selecting a different path
or empty the provided one.

Fixes: QTCREATORBUG-24173
Change-Id: I1e501b361d4917a59a5720146b11580e79ac32aa
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
Assam Boudjelthia
2020-06-11 15:51:20 +03:00
committed by Eike Ziller
parent eabe281b18
commit 759b38e2ac

View File

@@ -817,16 +817,16 @@ void AndroidSettingsWidget::downloadOpenSslRepo(const bool silent)
gitCloneCommand.toUserOutput(); gitCloneCommand.toUserOutput();
QDir openSslDir(openSslPath.toString()); QDir openSslDir(openSslPath.toString());
if (openSslDir.exists()) { const bool isEmptyDir = openSslDir.isEmpty(QDir::AllEntries | QDir::NoDotAndDotDot
auto userInput = QMessageBox::information(this, openSslCloneTitle, | QDir::Hidden | QDir::System);
tr("The selected download path (%1) for OpenSSL already exists. " if (openSslDir.exists() && !isEmptyDir) {
"Remove and overwrite its content?") QMessageBox::information(
.arg(QDir::toNativeSeparators(openSslPath.toString())), this,
QMessageBox::Yes | QMessageBox::No); openSslCloneTitle,
if (userInput == QMessageBox::Yes) tr("The selected download path (%1) for OpenSSL already exists and the directory is "
openSslDir.removeRecursively(); "not empty. Select a different path or make sure it is an empty directory.")
else .arg(QDir::toNativeSeparators(openSslPath.toString())));
return; return;
} }
QProgressDialog *openSslProgressDialog QProgressDialog *openSslProgressDialog