Commit 778e6675 authored by Tobias Hunger's avatar Tobias Hunger

Do not register the same Qt version under several names

Do not get fooled by the same qmake being available (via
symlinks) in several places on the file system. Just register
each Qt version once.

Change-Id: I8d5efb80599a697c32a3ca3ab37924bc9ab523eb
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent f8810811
......@@ -635,19 +635,24 @@ static QString filterForQmakeFileDialog()
void QtOptionsPageWidget::addQtDir()
{
Utils::FileName qtVersion = Utils::FileName::fromString(
QFileDialog::getOpenFileName(this,
tr("Select a qmake executable"),
QString(),
filterForQmakeFileDialog(),
0,
QFileDialog::DontResolveSymlinks));
QFileInfo(QFileDialog::getOpenFileName(this,
tr("Select a qmake executable"),
QString(),
filterForQmakeFileDialog(),
0,
QFileDialog::DontResolveSymlinks)).canonicalFilePath());
if (qtVersion.isNull())
return;
if (QtVersionManager::instance()->qtVersionForQMakeBinary(qtVersion)) {
BaseQtVersion *version = QtVersionManager::instance()->qtVersionForQMakeBinary(qtVersion);
if (version) {
// Already exist
QMessageBox::warning(this, tr("Qt known"),
tr("This Qt version was already registered as \"%1\".")
.arg(version->displayName()));
return;
}
BaseQtVersion *version = QtVersionFactory::createQtVersionFromQMakePath(qtVersion);
version = QtVersionFactory::createQtVersionFromQMakePath(qtVersion);
if (version) {
m_versions.append(version);
......
......@@ -623,9 +623,8 @@ Utils::FileName QtVersionManager::findQMakeBinaryFromMakefile(const QString &mak
#endif
// Is qmake still installed?
QFileInfo fi(qmakePath);
if (fi.exists()) {
return Utils::FileName(fi);
}
if (fi.exists())
return Utils::FileName::fromString(fi.canonicalFilePath());
}
}
}
......
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