My application uses the following code:
#if MAC_OS_X_VERSION_10_5 < MAC_OS_X_VERSION_MAX_ALLOWED
NSArray *globalPreferencePanes =
NSSearchPathForDirectoriesInDomains(NSPreferencePanesDirectory,
NSAllDomainsMask, YES);
#else
NSArray *globalPreferencePanes =
[NSArray arrayWithObjects:@"/Library/PreferencePanes",
[@"~/Library/PreferencePanes" stringByExpandingTildeInPath], nil];
#endif
return globalPreferencePanes;
The project under which I’m compiling this is aimed at the 10.5 Mac OSX SDK, where NSPreferencePanesDirectory does not exist (it only exists in 10.6+). Because of this, I have the #if and #else in order to check what version of Mac OSX we’re running under, so I know whether I should use the NSPreferencePanesDirectory or just manually give the location of the preference pane directories.
What should I change in order to stop getting this “use of undeclared identifier” error?
Thanks.
#ifis evaluated at compile time, not run time. What you probably want to do is use the current SDK (10.7), and do something like this:Making sure to set your target OS version to 10.5 so the symbol is weak linked. Otherwise, you could drop down and use CoreServices’
FSFindFolder():(Not tested)