path: root/src/corelib/io/qfilesystemengine_unix.cpp
diff options
authorSamuel Gaist <>2014-01-28 12:53:10 +0100
committerThe Qt Project <>2014-04-03 11:07:07 +0200
commitafacf694d5a6f34b88989e76971d70d700ce4949 (patch)
tree01e22f18e035be51e9f370dd7aa232da559ce607 /src/corelib/io/qfilesystemengine_unix.cpp
parent2d8b40439da7f3edbed3cfa7354f714686d6cdea (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 <> Reviewed-by: Jake Petroules <> Reviewed-by: Thiago Macieira <>
Diffstat (limited to 'src/corelib/io/qfilesystemengine_unix.cpp')
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
if (application) {
- CFStringRef path = CFURLGetString(application);
- QString applicationPath = QCFString::toQString(path);
- if (applicationPath != QLatin1String("file://localhost/System/Library/CoreServices/"))
+ QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, application);
+ CFStringRef identifier = CFBundleGetIdentifier(bundle);
+ QString applicationId = QCFString::toQString(identifier);
+ if (applicationId != QLatin1String(""))
return true;