Re: How to determine FCP version
Re: How to determine FCP version
- Subject: Re: How to determine FCP version
- From: Gregory Clarke <email@hidden>
- Date: Mon, 27 Apr 2009 09:59:11 -0700
It seems to work with NSBundle too, but you have to identify the
bundle first. (Warning, the following code is RubyCocoa rather than
Objective-C, but translation is easy).
require 'osx/cocoa'
fcp_path =
OSX
::NSWorkspace
.sharedWorkspace
.absolutePathForAppBundleWithIdentifier("com.apple.FinalCutPro")
fcp_bundle = OSX::NSBundle.bundleWithPath(fcp_path)
fcp_version =
fcp_bundle.objectForInfoDictionaryKey("CFBundleVersion").to_s
Greg
Sounds like a robust solution, but apparently the bundle has to exist
before you can call CFBundleGetBundleWithIdentifier. For future
generations (and for feedback), here is some code that has worked at
least once. :)
- (NSString *) determineFCPVersion {
// Returns the version number of Final Cut Pro in x.y.z format
#define bID "com.apple.FinalCutPro"
CFURLRef outAppURL;
Str255 s;
OSStatus status;
NumVersion version;
// Get the URL for FCP
status = LSFindApplicationForInfo (kLSUnknownCreator, CFSTR(bID),
NULL, NULL, &outAppURL);
if (status != noErr) @throw [NSException exceptionWithName:@"Failed
to get CFURLRef for" reason:[NSString stringWithCString:bID]
userInfo:nil];
// Create a bundle for FCP
CFBundleRef bRef = CFBundleCreate(kCFAllocatorDefault, outAppURL);
if (!bRef) @throw [NSException exceptionWithName:@"Failed to get
bundle ref for" reason:[NSString stringWithCString:bID] userInfo:nil];
// Get the version info from the bundle
*((UInt32*)&version) = CFBundleGetVersionNumber(bRef);
if ((version.minorAndBugRev & 0x0F) != 0) {
sprintf( (char*)s, "%d.%d.%d", version.majorRev,
version.minorAndBugRev >> 4, version.minorAndBugRev & 0x0F );
}
else {
sprintf( (char*)s, "%d.%d", version.majorRev,
version.minorAndBugRev >> 4 );
}
return [NSString stringWithCString:(char *)s];
#undef bID
}
Bruce
On Sun, Apr 26, 2009 at 10:11 AM, Darrin Cardani
<email@hidden> wrote:
An easier way is to use CFBundleGetVersionNumber (). You can call
CGBundleGetBundleWithIdentifier (CFSTR ("com.apple.finalcutpro"))
to get the CFBundleRef, then call CFBundleGetVersionNumber () with
it.
Darrin
On Apr 24, 2009, at 11:49 PM, Andreas Kiel wrote:
Hi Bruce,
How was NAB?
Here a "stupid but fast" solution from terminal "defaults read /
Applications/Final\ Cut\ Pro.app/Contents/Info CFBundleVersion" to
get the FCP version
Regards
Andreas
On 25.04.2009, at 08:10, Bruce Sharpe wrote:
Actually the solution I outlined below is no good: the first time
the effects are requested from FCP 6, it takes a loooong time to
return from the call, with lots of status messages flashing by.
So I'm still looking for a solution.
Bruce
On Fri, Apr 24, 2009 at 10:33 PM, Bruce Sharpe <email@hidden
> wrote:
To clarify, I am only interested in distinguishing between version
5 and version 6 or later. So far I am requesting the list of all
effects, an event that is not supported by version 5. If the data
size of the reply event is 0 I assume the version is 5. If it is
greater than 0, then I conclude it is version 6 or later.
Just wondering if there is something more straightforward and a
little less weird.
Bruce
On Fri, Apr 24, 2009 at 9:13 PM, Bruce Sharpe <email@hidden
> wrote:
Is there a recommended way to determine what version of FCP is
running, using Apple Events? I've tried a couple of things but am
not satisfied with the speed/reliability.
Bruce
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Darrin Cardani
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden