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>
This commit is contained in:
Samuel Gaist 2014-01-28 12:53:10 +01:00 committed by The Qt Project
parent 2d8b40439d
commit afacf694d5

View File

@ -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;
}
}