diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-04-02 23:16:28 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-05 08:16:19 +0200 |
commit | 2884d7c9aafda5ad2d84f1c7a1b4ea2625182885 (patch) | |
tree | 753efb0a011c20d21235025b488765fe6134895c /src/corelib | |
parent | 840a66501776b992623734ee37be0a46ecc42484 (diff) |
OS X: Improve QLibraryInfo app bundle testing.
QLibraryInfo::location() paths are relative to
"myapp.app/Contents/" when the application has a
bundle and relative to the executable when not.
However CFBundleGetMainBundle() can and will return
a valid CFBundleRef even if the application is built
as a standalone executable.
Add a test that verifies that the path constructed
with "/Contents" exists on disk. Fall back to the
non-bundle code path if it doesn't.
This bug was hit in cases where a qt.conf file was
present side-by-side with the app binary, for example
in qtbase/bin.
Task-number: QTBUG-38039
Change-Id: Id993599208fe94fff283c725778f8ad47b610ba7
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qlibraryinfo.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 39bfd339c3..6d25325890 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -498,7 +498,9 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) if (urlRef) { QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle); #ifdef Q_OS_MACX - return QDir::cleanPath(QString(path) + QLatin1String("/Contents/") + ret); + QString bundleContentsDir = QString(path) + QLatin1String("/Contents/"); + if (QDir(bundleContentsDir).exists()) + return QDir::cleanPath(bundleContentsDir + ret); #else return QDir::cleanPath(QString(path) + QLatin1Char('/') + ret); // iOS #endif |