QLibrary: succeed early for .dylib on Darwin
Drag the cheap check for 'fileName.endsWith(".dylib")' to before the
expensive operations (QFileInfo creation, extraction and splitting of
completeSuffix(), building of suffix candidate list, ...), at the cost
of a duplicated Q_OS_DARWIN check.
Change-Id: I8ed764f18f0beb8ad24c30ab806ecc5452159601
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
parent
cfa631e0fb
commit
991c471aa5
|
|
@ -664,6 +664,11 @@ bool QLibrary::isLibrary(const QString &fileName)
|
|||
#if defined(Q_OS_WIN)
|
||||
return fileName.endsWith(QLatin1String(".dll"), Qt::CaseInsensitive);
|
||||
#else // Generic Unix
|
||||
# if defined(Q_OS_DARWIN)
|
||||
// On Apple platforms, dylib look like libmylib.1.0.0.dylib
|
||||
if (fileName.endsWith(QLatin1String(".dylib")))
|
||||
return true;
|
||||
# endif
|
||||
QString completeSuffix = QFileInfo(fileName).completeSuffix();
|
||||
if (completeSuffix.isEmpty())
|
||||
return false;
|
||||
|
|
@ -683,10 +688,6 @@ bool QLibrary::isLibrary(const QString &fileName)
|
|||
# elif defined(Q_OS_AIX)
|
||||
validSuffixList << QLatin1String("a") << QLatin1String("so");
|
||||
# elif defined(Q_OS_DARWIN)
|
||||
// On Apple platforms, dylib look like libmylib.1.0.0.dylib
|
||||
if (suffixes.last() == QLatin1String("dylib"))
|
||||
return true;
|
||||
|
||||
validSuffixList << QLatin1String("so") << QLatin1String("bundle");
|
||||
# elif defined(Q_OS_UNIX)
|
||||
validSuffixList << QLatin1String("so");
|
||||
|
|
|
|||
Loading…
Reference in New Issue