diff options
author | Thomas Zander <t.zander@nokia.com> | 2010-09-03 09:35:45 +0200 |
---|---|---|
committer | Thomas Zander <t.zander@nokia.com> | 2010-09-03 09:35:45 +0200 |
commit | c7784c70b865792a5f09fc83e9a50cc327864a22 (patch) | |
tree | a34146f6147a7c2ea56bf0fe0ce39f2c8b8ca970 /src/corelib/io/qfilesystemengine_unix.cpp | |
parent | 34d8b4f0fa7f039504b62f2bbf84668f5345b643 (diff) |
Implement bundleName() in QFileSystemEngine
Move the code from the qfsfileengine_unix.cpp to the new place
and make the old place just call the new one.
Reviewed-by: João Abecasis
Diffstat (limited to 'src/corelib/io/qfilesystemengine_unix.cpp')
-rw-r--r-- | src/corelib/io/qfilesystemengine_unix.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index d4759c8732..4b1932d434 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -143,7 +143,17 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) //static QString QFileSystemEngine::bundleName(const QFileSystemEntry &entry) { - return QString(); // TODO implement; +#if !defined(QWS) && defined(Q_OS_MAC) + QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, QCFString(entry.filePath()), + kCFURLPOSIXPathStyle, true); + if (QCFType<CFDictionaryRef> dict = CFBundleCopyInfoDictionaryForURL(url)) { + if (CFTypeRef name = (CFTypeRef)CFDictionaryGetValue(dict, kCFBundleNameKey)) { + if (CFGetTypeID(name) == CFStringGetTypeID()) + return QCFString::toQString((CFStringRef)name); + } + } +#endif + return QString(); } //static |