--- src/corelib/io/qfilesystemengine_unix.cpp.orig +++ src/corelib/io/qfilesystemengine_unix.cpp @@ -83,6 +83,7 @@ return (fileInfo->finderFlags & kIsInvisible); } +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &entry) { if (!data.isDirectory()) @@ -138,6 +139,7 @@ FolderInfo *folderInfo = reinterpret_cast(catalogInfo.finderInfo); return folderInfo->finderFlags & kHasBundle; } +#endif #else static inline bool _q_isMacHidden(const char *nativePath) @@ -529,8 +531,22 @@ #if !defined(QWS) && !defined(Q_WS_QPA) && defined(Q_OS_MAC) if (what & QFileSystemMetaData::BundleType) { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 if (entryExists && isPackage(data, entry)) data.entryFlags |= QFileSystemMetaData::BundleType; +#else + if (entryExists && data.isDirectory()) { + QCFType path = CFStringCreateWithBytes(0, + (const UInt8*)nativeFilePath, nativeFilePathLength, + kCFStringEncodingUTF8, false); + QCFType url = CFURLCreateWithFileSystemPath(0, path, + kCFURLPOSIXPathStyle, true); + + UInt32 type, creator; + if (CFBundleGetPackageInfoInDirectory(url, &type, &creator)) + data.entryFlags |= QFileSystemMetaData::BundleType; + } +#endif data.knownFlagsMask |= QFileSystemMetaData::BundleType; } #endif