forked from qt-creator/qt-creator
reshuffle prepareProject() code a bit
looks more like qmake's code now. deals better with not-yet-existing output directories as well (QDir::cdUp() does not work with those). Change-Id: I062e581b7a9062f176a9bf8c686bf48b19ed0975 Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
@@ -940,24 +940,28 @@ void QMakeEvaluator::loadDefaults()
|
|||||||
bool QMakeEvaluator::prepareProject()
|
bool QMakeEvaluator::prepareProject()
|
||||||
{
|
{
|
||||||
if (m_option->do_cache) {
|
if (m_option->do_cache) {
|
||||||
QString qmake_cache = m_option->cachefile;
|
QString cachefile = m_option->cachefile;
|
||||||
if (qmake_cache.isEmpty() && !m_outputDir.isEmpty()) { //find it as it has not been specified
|
if (cachefile.isEmpty()) { //find it as it has not been specified
|
||||||
QDir dir(m_outputDir);
|
if (m_outputDir.isEmpty())
|
||||||
|
goto no_cache;
|
||||||
|
QString dir = m_outputDir;
|
||||||
forever {
|
forever {
|
||||||
qmake_cache = dir.path() + QLatin1String("/.qmake.cache");
|
cachefile = dir + QLatin1String("/.qmake.cache");
|
||||||
if (IoUtils::exists(qmake_cache))
|
if (IoUtils::exists(cachefile)) {
|
||||||
break;
|
m_buildRoot = dir;
|
||||||
if (!dir.cdUp() || dir.isRoot()) {
|
|
||||||
qmake_cache.clear();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
QFileInfo qdfi(dir);
|
||||||
|
if (qdfi.isRoot())
|
||||||
|
goto no_cache;
|
||||||
|
dir = qdfi.path();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
m_buildRoot = QFileInfo(cachefile).path();
|
||||||
}
|
}
|
||||||
if (!qmake_cache.isEmpty()) {
|
m_cachefile = cachefile;
|
||||||
m_cachefile = qmake_cache;
|
|
||||||
m_buildRoot = QFileInfo(qmake_cache).path();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
no_cache:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user