summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-12-08 10:42:57 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-12-09 13:31:37 (GMT)
commit6135da7c97830ea46ca807b7cf5944dc74fdb960 (patch)
treefcf4510c33d2d3e58a3cba3cf3d0e162c1c775e7 /src/corelib/io
parent5b2cdd7cdeec0bb77e331d6ef78ecf3b678b0764 (diff)
downloadQt-6135da7c97830ea46ca807b7cf5944dc74fdb960.zip
Qt-6135da7c97830ea46ca807b7cf5944dc74fdb960.tar.gz
Qt-6135da7c97830ea46ca807b7cf5944dc74fdb960.tar.bz2
Use realpath only on OS we know it works on.
As far as we know realpath(X,0) extenstion is only supported on Linux, Mac OS X starting with 10.6 and on Symbian. Here goes the trick: realpath() on Mac properly handles file systems case-sensitivity, meaning two files with different cases will are the same file if the file system is case insensitive (which is the default on Mac). However the QFSFileEngine will still say that the file system is case sensitive because on Mac you can have several drives with different file systems (with different case sensitivity), and QFSFileEngine doesn't allow to return different values depending on the file path, so we still say that the file system is case-sensitive, which is the safiest behavior. This changes the behavior on Mac, but changes it to be correct. Reviewed-by: Markus Goetz Reviewed-by: João Abecasis
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qfsfileengine.cpp12
1 files changed, 9 insertions, 3 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);