On 8 Aug 2011, at 16:42, Sean McBride wrote:

On Mon, 8 Aug 2011 16:13:50 -0600, Stephen Blinkhorn said:

To be clear, you'd need to use ~/Library/App Support not the one in /
Library.

OK, no problem in Cocoa with the stringByExpandingTildeInPath: method
of NSString. More problematic for CFStringRef though. Is there an
acknowledged way of doing the equivalent with CFStringRefs? I
appreciate this is nolonger a Cocoa issue.

Actually, don't use stringByExpandingTildeInPath:. Paths are deprecated, you should use NSURL or CFURL to reference file system objects. Instead, do something like this:

        NSFileManager* fileManager = [[NSFileManager alloc] init];
        NSError* error = nil;
NSURL* url = [fileManager URLForDirectory:NSApplicationSupportDirectory
                                                                                
                         inDomain:NSUserDomainMask
                                                                                
        appropriateForURL:nil
                                                                                
                           create:YES
                                                                                    
                            error:&error];

Not sure about at the CF level... you could use FSFindFolder() I guess.

[fileManager URLForDirectory:..] is 10.6+ only and since I'm supporting 10.4 through 10.7 I'm using FSFindFolder() for now and it's all working, even on Lion!

Thanks,
Stephen




--
____________________________________________________________
Sean McBride, B. Eng                 s...@rogue-research.com
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to