diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2014-01-28 12:53:10 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-03 11:07:07 +0200 |
commit | afacf694d5a6f34b88989e76971d70d700ce4949 (patch) | |
tree | 01e22f18e035be51e9f370dd7aa232da559ce607 /src | |
parent | 2d8b40439da7f3edbed3cfa7354f714686d6cdea (diff) |
Use Finder bundle identifier over path for OS X bundle detection
Currently, checking if Finder is the application returned for
opening a bundle is done using its absolute path. Finder might
be relocated in future OS X versions which makes this approach
less clean.
Using Finder's bundle identifier allows us to ignore where it is
stored in the filesystem as the identifier will not change.
Task-number: QTBUG-31884
Change-Id: Ib4c3412fb206fadda04eb547bc6a4eef02ee949a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qfilesystemengine_unix.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 6c0f31fb55..eabedaa80a 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -113,9 +113,10 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e &application); if (application) { - CFStringRef path = CFURLGetString(application); - QString applicationPath = QCFString::toQString(path); - if (applicationPath != QLatin1String("file://localhost/System/Library/CoreServices/Finder.app/")) + QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, application); + CFStringRef identifier = CFBundleGetIdentifier(bundle); + QString applicationId = QCFString::toQString(identifier); + if (applicationId != QLatin1String("com.apple.finder")) return true; } } |