diff -r b72c6db6890b -r 5dc02b23752f src/corelib/io/qfsfileengine.cpp --- a/src/corelib/io/qfsfileengine.cpp Wed Jun 23 19:07:03 2010 +0300 +++ b/src/corelib/io/qfsfileengine.cpp Tue Jul 06 15:10:48 2010 +0300 @@ -56,6 +56,9 @@ #endif #include #include +#if defined(Q_OS_MAC) +# include +#endif QT_BEGIN_NAMESPACE @@ -123,8 +126,10 @@ fileAttrib = INVALID_FILE_ATTRIBUTES; fileHandle = INVALID_HANDLE_VALUE; mapHandle = INVALID_HANDLE_VALUE; +#ifndef Q_OS_WINCE cachedFd = -1; #endif +#endif } /*! @@ -143,11 +148,29 @@ 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_LINUX) || defined(Q_OS_SYMBIAN) +#if defined(Q_OS_LINUX) || defined(Q_OS_SYMBIAN) || defined(Q_OS_MAC) // ... but Linux with uClibc does not have it #if !defined(__UCLIBC__) - char *ret = realpath(path.toLocal8Bit().constData(), (char*)0); + 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 { + // on 10.5 we can use FSRef to resolve the file path. + FSRef fsref; + if (FSPathMakeRef((const UInt8 *)QDir::cleanPath(path).toUtf8().data(), &fsref, 0) == noErr) { + CFURLRef urlref = CFURLCreateFromFSRef(NULL, &fsref); + CFStringRef canonicalPath = CFURLCopyFileSystemPath(urlref, kCFURLPOSIXPathStyle); + QString ret = QCFString::toQString(canonicalPath); + CFRelease(canonicalPath); + CFRelease(urlref); + return ret; + } + } +#else + ret = realpath(path.toLocal8Bit().constData(), (char*)0); +#endif if (ret) { QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret)); free(ret); @@ -1012,6 +1035,10 @@ to store temporary files). */ +/*! \fn QAbstractFileEngine::FileFlags QFSFileEnginePrivate::getPermissions(QAbstractFileEngine::FileFlags type) const + \internal +*/ + QT_END_NAMESPACE #endif // QT_NO_FSFILEENGINE