From 8be4ea0063dac6091ce896d019a149864b5d0003 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Thu, 29 Apr 2010 16:56:12 +0200 Subject: Fix to allow upper- and lowercase .dll suffix on windows This fix is needed since windows uses case insensitive filesystems. Reviewed-by: Joao Task-number: QTBUG-10305 --- src/corelib/plugin/qlibrary.cpp | 4 ++-- tests/auto/qlibrary/tst_qlibrary.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 266c29e..1d8196f 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -496,7 +496,7 @@ bool QLibraryPrivate::loadPlugin() \table \header \i Platform \i Valid suffixes - \row \i Windows \i \c .dll + \row \i Windows \i \c .dll, \c .DLL \row \i Unix/Linux \i \c .so \row \i AIX \i \c .a \row \i HP-UX \i \c .sl, \c .so (HP-UXi) @@ -509,7 +509,7 @@ bool QLibraryPrivate::loadPlugin() bool QLibrary::isLibrary(const QString &fileName) { #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) - return fileName.endsWith(QLatin1String(".dll")); + return fileName.endsWith(QLatin1String(".dll"), Qt::CaseInsensitive); #elif defined(Q_OS_SYMBIAN) // Plugin stubs are also considered libraries in Symbian. return (fileName.endsWith(QLatin1String(".dll")) || diff --git a/tests/auto/qlibrary/tst_qlibrary.cpp b/tests/auto/qlibrary/tst_qlibrary.cpp index 6ea9ed4..0478653 100644 --- a/tests/auto/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/qlibrary/tst_qlibrary.cpp @@ -53,6 +53,7 @@ #define a_VALID false #define so_VALID false #define dll_VALID false +#define DLL_VALID false #if defined(Q_OS_DARWIN) # undef bundle_VALID @@ -88,6 +89,8 @@ #elif defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) # undef dll_VALID # define dll_VALID true +# undef DLL_VALID +# define DLL_VALID true # define SUFFIX ".dll" # define PREFIX "" @@ -352,6 +355,7 @@ void tst_QLibrary::isLibrary_data() QTest::newRow(".a") << QString("mylib.a") << a_VALID; QTest::newRow(".bundle") << QString("mylib.bundle") << bundle_VALID; QTest::newRow(".dll") << QString("mylib.dll") << dll_VALID; + QTest::newRow(".DLL") << QString("MYLIB.DLL") << DLL_VALID; QTest::newRow(".dl2" ) << QString("mylib.dl2") << false; QTest::newRow(".dylib") << QString("mylib.dylib") << dylib_VALID; QTest::newRow(".sl") << QString("mylib.sl") << sl_VALID; @@ -556,7 +560,11 @@ void tst_QLibrary::fileName() } QVERIFY(ok); +#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) + QCOMPARE(lib.fileName().toLower(), expectedFilename.toLower()); +#else QCOMPARE(lib.fileName(), expectedFilename); +#endif } -- cgit v0.12