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>
This commit is contained in:
parent
840a665017
commit
2884d7c9aa
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user