Commit 2f8ca8f8 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

VCS: Prevent checkout/clone over an existing non-empty directory



Task-number: QTCREATORBUG-11701
Change-Id: Iee87deec59a8abed8930096c53e3c3514a208486
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 0aabacb7
......@@ -30,6 +30,7 @@
#include "basecheckoutwizardpage.h"
#include "ui_basecheckoutwizardpage.h"
#include <QDir>
#include <QIcon>
/*!
......@@ -105,9 +106,14 @@ void BaseCheckoutWizardPage::addRepositoryControl(QWidget *w)
bool BaseCheckoutWizardPage::checkIsValid() const
{
return d->ui.pathChooser->isValid()
&& !d->ui.checkoutDirectoryLineEdit->text().isEmpty()
&& !d->ui.repositoryLineEdit->text().isEmpty();
if (!d->ui.pathChooser->isValid() || d->ui.repositoryLineEdit->text().isEmpty())
return false;
const QString checkoutDirectory = d->ui.checkoutDirectoryLineEdit->text();
if (checkoutDirectory.isEmpty())
return false;
const QDir dir(d->ui.pathChooser->path() + QLatin1Char('/') + checkoutDirectory);
return !dir.exists() || (dir.count() <= 2);
}
void BaseCheckoutWizardPage::addRepositoryControl(QString &description, QWidget *w)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment