From 0df494a5a1119807c39b7a791448d254f72d3ce3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 18 Jun 2012 10:22:05 +0200 Subject: [PATCH] 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 Reviewed-by: Oswald Buddenhagen --- src/shared/proparser/qmakeevaluator.cpp | 28 ++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index 4a72bc0c68f..53a3da89b28 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -940,24 +940,28 @@ void QMakeEvaluator::loadDefaults() bool QMakeEvaluator::prepareProject() { if (m_option->do_cache) { - QString qmake_cache = m_option->cachefile; - if (qmake_cache.isEmpty() && !m_outputDir.isEmpty()) { //find it as it has not been specified - QDir dir(m_outputDir); + QString cachefile = m_option->cachefile; + if (cachefile.isEmpty()) { //find it as it has not been specified + if (m_outputDir.isEmpty()) + goto no_cache; + QString dir = m_outputDir; forever { - qmake_cache = dir.path() + QLatin1String("/.qmake.cache"); - if (IoUtils::exists(qmake_cache)) - break; - if (!dir.cdUp() || dir.isRoot()) { - qmake_cache.clear(); + cachefile = dir + QLatin1String("/.qmake.cache"); + if (IoUtils::exists(cachefile)) { + m_buildRoot = dir; 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 = qmake_cache; - m_buildRoot = QFileInfo(qmake_cache).path(); - } + m_cachefile = cachefile; } + no_cache: return true; }