diff options
author | Zeno Albisser <zeno.albisser@nokia.com> | 2010-06-11 11:06:38 (GMT) |
---|---|---|
committer | Zeno Albisser <zeno.albisser@nokia.com> | 2010-06-11 12:48:53 (GMT) |
commit | 999caa5d5418cde3bf0cb531fe2c1e15da537dd9 (patch) | |
tree | b17fb765b6a9cf8a2e21c1930dd59b18f20c9739 /src/corelib/plugin/qlibrary_unix.cpp | |
parent | 5d82a49aeba2a4b2608ea114702920ced97faddf (diff) | |
download | Qt-999caa5d5418cde3bf0cb531fe2c1e15da537dd9.zip Qt-999caa5d5418cde3bf0cb531fe2c1e15da537dd9.tar.gz Qt-999caa5d5418cde3bf0cb531fe2c1e15da537dd9.tar.bz2 |
Adjust handling of library .bundle on Mac
QLibrary::isLibrary() returns true for files with the sufix .bundle.
But we did not use to determine the proper library within the bundle
in that case.
Reviewed-by: Fabien Freling
Task-number: QTBUG-11217
Diffstat (limited to 'src/corelib/plugin/qlibrary_unix.cpp')
-rw-r--r-- | src/corelib/plugin/qlibrary_unix.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index e8f0eae..9ad1c01 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -223,11 +223,15 @@ bool QLibraryPrivate::load_sys() #ifdef Q_OS_MAC if (!pHnd) { - if (CFBundleRef bundle = CFBundleGetBundleWithIdentifier(QCFString(fileName))) { + QByteArray utf8Bundle = fileName.toUtf8(); + QCFType<CFURLRef> bundleUrl = CFURLCreateFromFileSystemRepresentation(NULL, reinterpret_cast<const UInt8*>(utf8Bundle.data()), utf8Bundle.length(), true); + QCFType<CFBundleRef> bundle = CFBundleCreate(NULL, bundleUrl); + if(bundle) { QCFType<CFURLRef> url = CFBundleCopyExecutableURL(bundle); - QCFString str = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle); - pHnd = dlopen(QFile::encodeName(str), dlFlags); - attempt = str; + char executableFile[FILENAME_MAX]; + CFURLGetFileSystemRepresentation(url, true, reinterpret_cast<UInt8*>(executableFile), FILENAME_MAX); + attempt = QString::fromUtf8(executableFile); + pHnd = dlopen(QFile::encodeName(attempt), dlFlags); } } #endif |