diff options
-rw-r--r-- | src/corelib/io/qfsfileengine.cpp | 12 | ||||
-rw-r--r-- | tests/auto/qfileinfo/tst_qfileinfo.cpp | 15 |
2 files changed, 23 insertions, 4 deletions
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 37b0ea1..f874052 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -143,9 +143,15 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path) if (path.size() == 1 && path.at(0) == QLatin1Char('/')) return path; #endif - // Mac OS X 10.5.x doesn't support the realpath(X,0) extenstion we use here. -#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) || defined(Q_OS_SYMBIAN) - char *ret = realpath(path.toLocal8Bit().constData(), (char*)0); +#if defined(Q_OS_LINUX) || defined(Q_OS_SYMBIAN) || defined(Q_OS_MAC) + char *ret = 0; +#if defined(Q_OS_MAC) + // Mac OS X 10.5.x doesn't support the realpath(X,0) extension we use here. + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) + ret = realpath(path.toLocal8Bit().constData(), (char*)0); +#else + ret = realpath(path.toLocal8Bit().constData(), (char*)0); +#endif if (ret) { QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); free(ret); diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index cd58fd6..b49395f 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -826,6 +826,17 @@ void tst_QFileInfo::compare_data() QTest::addColumn<QString>("file2"); QTest::addColumn<bool>("same"); +#if defined(Q_OS_MAC) + // Since 10.6 we use realpath() in qfsfileengine, and it properly handles + // file system case sensitivity. However here in the autotest we don't + // check if the file system is case sensitive, so to make it pass in the + // default OS X installation we assume we are running on a case insensitive + // file system if on 10.6 and on a case sensitive file system if on 10.5 + bool caseSensitiveOnMac = true; + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) + caseSensitiveOnMac = false; +#endif + QTest::newRow("data0") << QString::fromLatin1(SRCDIR "tst_qfileinfo.cpp") << QString::fromLatin1(SRCDIR "tst_qfileinfo.cpp") @@ -843,6 +854,8 @@ void tst_QFileInfo::compare_data() << QString::fromLatin1(SRCDIR "tst_qfileinfo.cpp") #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) << true; +#elif defined(Q_OS_MAC) + << !caseSensitiveOnMac; #else << false; #endif @@ -854,7 +867,7 @@ void tst_QFileInfo::compare() QFETCH(QString, file2); QFETCH(bool, same); QFileInfo fi1(file1), fi2(file2); - QCOMPARE(same, fi1 == fi2); + QCOMPARE(fi1 == fi2, same); } void tst_QFileInfo::consistent_data() |