summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-09-09 18:41:52 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-12 18:25:54 +0200
commit0192bf919fe03ac8e85190fa1c09720339eb9dd2 (patch)
treefe90c1849255ace99d5deacdb51909132025a4a8 /qmake
parent6f87278e0acd554f890f87118c48d5df8ae4174c (diff)
find qt.conf more reliably
a qmake invoked with a relative path would not find qt.conf, because it already changed CWD, which would confuse our copy of QCoreApplication::applicationFilePath() (see also QTBUG-21381). we already have the absolute path to the qmake executable in Option::qmake_abslocation, so just use it. (cherry picked from commit c378e16e57e8ce2255116e7fdb5436524cccb8c7) Change-Id: Icfe4254722e0855f6755b639f4c86f15bc7323ba Reviewed-on: http://codereview.qt-project.org/4565 Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/option.cpp59
1 files changed, 3 insertions, 56 deletions
diff --git a/qmake/option.cpp b/qmake/option.cpp
index 31372ab815..c3e89de818 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -750,64 +750,11 @@ qmakeAddCacheClear(qmakeCacheClearFunc func, void **data)
cache_items.append(new QMakeCacheClearItem(func, data));
}
-#ifdef Q_OS_WIN
-# include <windows.h>
-
-QT_USE_NAMESPACE
-#endif
-
QString qmake_libraryInfoFile()
{
- QString ret;
-#if defined( Q_OS_WIN )
- wchar_t module_name[MAX_PATH];
- GetModuleFileName(0, module_name, MAX_PATH);
- QFileInfo filePath = QString::fromWCharArray(module_name);
- ret = filePath.filePath();
-#else
- QString argv0 = QFile::decodeName(QByteArray(Option::application_argv0));
- QString absPath;
-
- if (!argv0.isEmpty() && argv0.at(0) == QLatin1Char('/')) {
- /*
- If argv0 starts with a slash, it is already an absolute
- file path.
- */
- absPath = argv0;
- } else if (argv0.contains(QLatin1Char('/'))) {
- /*
- If argv0 contains one or more slashes, it is a file path
- relative to the current directory.
- */
- absPath = QDir::current().absoluteFilePath(argv0);
- } else {
- /*
- Otherwise, the file path has to be determined using the
- PATH environment variable.
- */
- QByteArray pEnv = qgetenv("PATH");
- QDir currentDir = QDir::current();
- QStringList paths = QString::fromLocal8Bit(pEnv.constData()).split(QLatin1String(":"));
- for (QStringList::const_iterator p = paths.constBegin(); p != paths.constEnd(); ++p) {
- if ((*p).isEmpty())
- continue;
- QString candidate = currentDir.absoluteFilePath(*p + QLatin1Char('/') + argv0);
- QFileInfo candidate_fi(candidate);
- if (candidate_fi.exists() && !candidate_fi.isDir()) {
- absPath = candidate;
- break;
- }
- }
- }
-
- absPath = QDir::cleanPath(absPath);
-
- QFileInfo fi(absPath);
- ret = fi.exists() ? fi.canonicalFilePath() : QString();
-#endif
- if(!ret.isEmpty())
- ret = QDir(QFileInfo(ret).absolutePath()).filePath("qt.conf");
- return ret;
+ if(!Option::qmake_abslocation.isEmpty())
+ return QDir(QFileInfo(Option::qmake_abslocation).absolutePath()).filePath("qt.conf");
+ return QString();
}
QT_END_NAMESPACE