forked from qt-creator/qt-creator
move sysrootify() out of ProFileEvaluator::Private
it's a higher-level function which will not fit here soon Change-Id: I42ab45a953b2fea3ba1cb467eeff96fd58fc57be Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -180,7 +180,6 @@ public:
|
||||
|
||||
QString expandEnvVars(const QString &str) const;
|
||||
QString fixPathToLocalOS(const QString &str) const;
|
||||
QString sysrootify(const QString &path, const QString &baseDir) const;
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
void runProcess(QProcess *proc, const QString &command, QProcess::ProcessChannel chan) const;
|
||||
@@ -1450,19 +1449,6 @@ QString ProFileEvaluator::Private::currentDirectory() const
|
||||
return cur->directoryName();
|
||||
}
|
||||
|
||||
QString ProFileEvaluator::Private::sysrootify(const QString &path, const QString &baseDir) const
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
Qt::CaseSensitivity cs = Qt::CaseInsensitive;
|
||||
#else
|
||||
Qt::CaseSensitivity cs = Qt::CaseSensitive;
|
||||
#endif
|
||||
const bool isHostSystemPath = m_option->sysroot.isEmpty() || path.startsWith(m_option->sysroot, cs)
|
||||
|| path.startsWith(baseDir, cs) || path.startsWith(m_outputDir, cs);
|
||||
|
||||
return isHostSystemPath ? path : m_option->sysroot + path;
|
||||
}
|
||||
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
void ProFileEvaluator::Private::runProcess(QProcess *proc, const QString &command,
|
||||
QProcess::ProcessChannel chan) const
|
||||
@@ -3321,13 +3307,27 @@ QStringList ProFileEvaluator::values(const QString &variableName, const ProFile
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString ProFileEvaluator::sysrootify(const QString &path, const QString &baseDir) const
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
Qt::CaseSensitivity cs = Qt::CaseInsensitive;
|
||||
#else
|
||||
Qt::CaseSensitivity cs = Qt::CaseSensitive;
|
||||
#endif
|
||||
const bool isHostSystemPath =
|
||||
d->m_option->sysroot.isEmpty() || path.startsWith(d->m_option->sysroot, cs)
|
||||
|| path.startsWith(baseDir, cs) || path.startsWith(d->m_outputDir, cs);
|
||||
|
||||
return isHostSystemPath ? path : d->m_option->sysroot + path;
|
||||
}
|
||||
|
||||
QStringList ProFileEvaluator::absolutePathValues(
|
||||
const QString &variable, const QString &baseDirectory) const
|
||||
{
|
||||
QStringList result;
|
||||
foreach (const QString &el, values(variable)) {
|
||||
QString absEl = IoUtils::isAbsolutePath(el)
|
||||
? d->sysrootify(el, baseDirectory) : IoUtils::resolvePath(baseDirectory, el);
|
||||
? sysrootify(el, baseDirectory) : IoUtils::resolvePath(baseDirectory, el);
|
||||
if (IoUtils::fileType(absEl) == IoUtils::FileIsDir)
|
||||
result << QDir::cleanPath(absEl);
|
||||
}
|
||||
@@ -3342,7 +3342,7 @@ QStringList ProFileEvaluator::absoluteFileValues(
|
||||
foreach (const QString &el, pro ? values(variable, pro) : values(variable)) {
|
||||
QString absEl;
|
||||
if (IoUtils::isAbsolutePath(el)) {
|
||||
const QString elWithSysroot = d->sysrootify(el, baseDirectory);
|
||||
const QString elWithSysroot = sysrootify(el, baseDirectory);
|
||||
if (IoUtils::exists(elWithSysroot)) {
|
||||
result << QDir::cleanPath(elWithSysroot);
|
||||
goto next;
|
||||
|
||||
@@ -106,6 +106,8 @@ public:
|
||||
QString propertyValue(const QString &val) const;
|
||||
|
||||
private:
|
||||
QString sysrootify(const QString &path, const QString &baseDir) const;
|
||||
|
||||
Private *d;
|
||||
|
||||
friend class QMakeGlobals;
|
||||
|
||||
Reference in New Issue
Block a user