diff options
author | Thomas Zander <t.zander@nokia.com> | 2010-09-03 07:35:45 (GMT) |
---|---|---|
committer | Thomas Zander <t.zander@nokia.com> | 2010-09-03 07:35:45 (GMT) |
commit | c7784c70b865792a5f09fc83e9a50cc327864a22 (patch) | |
tree | a34146f6147a7c2ea56bf0fe0ce39f2c8b8ca970 | |
parent | 34d8b4f0fa7f039504b62f2bbf84668f5345b643 (diff) | |
download | Qt-c7784c70b865792a5f09fc83e9a50cc327864a22.zip Qt-c7784c70b865792a5f09fc83e9a50cc327864a22.tar.gz Qt-c7784c70b865792a5f09fc83e9a50cc327864a22.tar.bz2 |
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
-rw-r--r-- | src/corelib/io/qfilesystemengine_unix.cpp | 12 | ||||
-rw-r--r-- | src/corelib/io/qfilesystemengine_win.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qfsfileengine_unix.cpp | 12 |
3 files changed, 13 insertions, 13 deletions
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index d4759c8..4b1932d 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 diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index dd6467a..ef47fe5 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -69,7 +69,7 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry) //static QString QFileSystemEngine::bundleName(const QFileSystemEntry &entry) { - return QString(); // TODO implement; + return QString(); } //static diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 0b73a7b..9ca195b 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1002,17 +1002,7 @@ QString QFSFileEngine::fileName(FileName file) const { Q_D(const QFSFileEngine); if (file == BundleName) { -#if !defined(QWS) && defined(Q_OS_MAC) - QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, QCFString(d->fileEntry.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(); + return QFileSystemEngine::bundleName(d->fileEntry); } else if (file == BaseName) { return d->fileEntry.fileName(); } else if (file == PathName) { |