Don't ignore debug plugins on Mac when release plugins aren't available

Previously, we unconditionally ignored any plugins whose names ended
with _debug.dylib.  This makes the mediaservice plugins unusable on Mac
if Qt is configured to build plugins as debug-only (which is
incidentally the default).

Change-Id: I5a8981b2251e803fa233b74c968f6eaa452d367c
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
Rohan McGovern
2011-10-25 11:05:20 +10:00
committed by Qt by Nokia
parent ab52443dc5
commit 1718443801

View File

@@ -121,15 +121,36 @@ QStringList QMediaPluginLoader::availablePlugins() const
foreach (const QString &path, paths) { foreach (const QString &path, paths) {
QDir typeDir(path + m_location); QDir typeDir(path + m_location);
foreach (const QString &file, typeDir.entryList(QDir::Files)) { foreach (const QString &file, typeDir.entryList(QDir::Files, QDir::Name)) {
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
if (!imageSuffix.isEmpty()) { // Only add appropriate images if (!imageSuffix.isEmpty()) { // Only add appropriate images
if (file.lastIndexOf(imageSuffix, -6) == -1) if (file.lastIndexOf(imageSuffix, -6) == -1)
continue; continue;
} else { // Ignore any images with common suffixes } else {
if (file.endsWith(QLatin1String("_debug.dylib")) || int foundSuffix = file.lastIndexOf(QLatin1String("_debug.dylib"));
file.endsWith(QLatin1String("_profile.dylib"))) if (foundSuffix == -1) {
continue; foundSuffix = file.lastIndexOf(QLatin1String("_profile.dylib"));
}
if (foundSuffix != -1) {
/*
If this is a "special" version of the plugin, prefer the release
version, where available.
Avoids warnings like:
objc[23101]: Class TransparentQTMovieView is implemented in both
libqqt7engine_debug.dylib and libqqt7engine.dylib. One of the two
will be used. Which one is undefined.
Note, this code relies on QDir::Name sorting!
*/
QString preferred =
typeDir.absoluteFilePath(file.left(foundSuffix) + QLatin1String(".dylib"));
if (plugins.contains(preferred)) {
continue;
}
}
} }
#elif defined(Q_OS_UNIX) #elif defined(Q_OS_UNIX)
// Ignore separate debug files // Ignore separate debug files