Re: FSSpec --> OSX Path NSString
Re: FSSpec --> OSX Path NSString
- Subject: Re: FSSpec --> OSX Path NSString
- From: Chris Hanson <email@hidden>
- Date: Wed, 12 Mar 2003 16:00:19 -0600
At 2:43 PM -0600 3/12/03, Frank Midgley wrote:
This is really a Carbon question, but if you know the file exists on
disk then use FSpMakeFSRef and pass the resultant FSRef to
FSRefMakePath to get a C string of the path.
I've seen lots of references to FSRefMakePath. Don't use it, it
requires you to pass a fixed-size buffer which (when Apple fixes the
kernel & standard library not to have a limit on path length) could
be smaller than the actual path.
Instead, create a CFURL from your FSRef and then use CFURLCopyPath to
get its POSIX path as a CFString.
My BDAlias class <
http://bdistributed.com/Projects/BDAlias/> works
this way. Right now you can't make a BDAlias directly from an
FSSpec, but that would be trivial to add. BDAlias has the advantage
of actually using an alias record to represent the file, which is
safe to store in things like preferences files.
-- Chris
--
Chris Hanson, bDistributed.com, Inc. | Email: email@hidden
Custom Application Development | Phone: +1-847-372-3955
http://bdistributed.com/ | Fax: +1-847-589-3738
http://bdistributed.com/Articles/ | Personal Email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.