For my app, I have the user choose the path for a specific application of their computer. From that path (i.e. /Applications/Itunes.app) I would like to get the bundle identifier, and create an NSRunningApplication
instance from it ([NSRunningApplication runningApplicationsWithBundleIdentifier:(nonnull NSString *)];
How would I go about getting this bundle identifier?
Use the core foundation function CFBundleGetIdentifier
Create the bundle reference from the path to the bundle with CFURLCreateFromFileSystemRepresentation
and call CFBundleCreate
url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, bundlePath, bundleLength, true);
bundle = CFBundleCreate(kCFAllocatorDefault, url);
CFStringRef identifier = CFBundleGetIdentifier(bundle)