Commit 56a1e109 authored by dt's avatar dt
Browse files

Qt4ProjectManager: Do not loop endless if the defaöt mkspec is broken

Reported on irc.
parent 8108bb0c
......@@ -1381,11 +1381,7 @@ void QtVersion::updateToolChainAndMkspec() const
mkspecFullPath = baseMkspecDir + "/macx-g++";
}
//resolve mkspec link
QFileInfo f3(mkspecFullPath);
while (f3.isSymLink()) {
mkspecFullPath = f3.symLinkTarget();
f3.setFile(mkspecFullPath);
}
mkspecFullPath = resolveLink(mkspecFullPath);
}
break;
}
......@@ -1393,11 +1389,7 @@ void QtVersion::updateToolChainAndMkspec() const
f2.close();
}
#else
QFileInfo f2(mkspecFullPath);
while (f2.isSymLink()) {
mkspecFullPath = f2.symLinkTarget();
f2.setFile(mkspecFullPath);
}
mkspecFullPath =resolveLink(mkspecFullPath);
#endif
#ifdef Q_OS_WIN
......@@ -1526,6 +1518,17 @@ void QtVersion::updateToolChainAndMkspec() const
m_toolChainUpToDate = true;
}
QString QtVersion::resolveLink(const QString &path) const
{
QFileInfo f(path);
int links = 16;
while (links-- && f.isSymLink())
f.setFile(f.symLinkTarget());
if (links <= 0)
return QString();
return f.path();
}
QString QtVersion::mwcDirectory() const
{
return m_mwcDirectory;
......@@ -1622,7 +1625,8 @@ bool QtVersion::isValid() const
&& !qmakeCommand().isEmpty()
&& !displayName().isEmpty()
&& !m_notInstalled
&& m_versionInfo.contains("QT_INSTALL_BINS");
&& m_versionInfo.contains("QT_INSTALL_BINS")
&& !m_mkspecFullPath.isEmpty();
}
QString QtVersion::invalidReason() const
......@@ -1638,6 +1642,8 @@ QString QtVersion::invalidReason() const
if (!m_versionInfo.contains("QT_INSTALL_BINS"))
return QCoreApplication::translate("QtVersion",
"Could not determine the path to the binaries of the Qt installation, maybe the qmake path is wrong?");
if (m_mkspecFullPath.isEmpty())
return QCoreApplication::translate("QtVersion", "The default mkspec symlink is broken.");
return QString();
}
......
......@@ -189,6 +189,7 @@ private:
void updateVersionInfo() const;
QString findQtBinary(const QStringList &possibleName) const;
void updateToolChainAndMkspec() const;
QString resolveLink(const QString &path) const;
QString m_displayName;
QString m_sourcePath;
QString m_mingwDirectory;
......
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