From 36974b766ea4dac594680b246dd22311c30f9adb Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Fri, 11 Jun 2010 13:06:38 +0200 Subject: 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 --- src/corelib/plugin/qlibrary_unix.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index e9b3628..3f73989 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 bundleUrl = CFURLCreateFromFileSystemRepresentation(NULL, reinterpret_cast(utf8Bundle.data()), utf8Bundle.length(), true); + QCFType bundle = CFBundleCreate(NULL, bundleUrl); + if(bundle) { QCFType 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(executableFile), FILENAME_MAX); + attempt = QString::fromUtf8(executableFile); + pHnd = dlopen(QFile::encodeName(attempt), dlFlags); } } #endif -- cgit v0.12