Re: Convert NSString to FSRef

2008-03-17 Thread Kevin Dixon
Thanks for all the feed back, its been most helpful. -Kevin On Mar 15, 2008, at 12:04 PM, Kevin Dixon wrote: I'm trying to write a method that will convert a NSString containing a file system URL to an FSRef with the following code - (FSRef)stringToFSRef: (NSString*)filePath { FSRef

Re: Convert NSString to FSRef

2008-03-16 Thread Stuart Malin
Kevin, Here's two variants that you can start to work with. Use the first one if it works. The second one is a more roundabout way of getting the NSString to bytes. Two disclaimers: 1: I have never worked with CF functions before, but have been doing a bit of string-data-bytes

Re: Convert NSString to FSRef

2008-03-16 Thread stephen joseph butler
On Sat, Mar 15, 2008 at 2:04 PM, Kevin Dixon [EMAIL PROTECTED] wrote: Also, is there a better way to accomplish this? There are a lot of buggy or unnecessarily complex answers in this thread. Use the code at the bottom of this CocoaDev link and be done with it:

Re: Convert NSString to FSRef

2008-03-16 Thread Nir Soffer
On Mar 16, 2008, at 10:11, stephen joseph butler wrote: On Sat, Mar 15, 2008 at 2:04 PM, Kevin Dixon [EMAIL PROTECTED] wrote: Also, is there a better way to accomplish this? There are a lot of buggy or unnecessarily complex answers in this thread. Use the code at the bottom of this

Re: Convert NSString to FSRef

2008-03-16 Thread Jean-Daniel Dupas
Le 16 mars 08 à 07:49, Stuart Malin a écrit : Kevin, Here's two variants that you can start to work with. Use the first one if it works. The second one is a more roundabout way of getting the NSString to bytes. Two disclaimers: 1: I have never worked with CF functions before, but have

Re: Convert NSString to FSRef

2008-03-16 Thread Stuart Malin
Jens, Thank you for pointing these out. I provided the info I did because I hadn't seen anyone else reply to Kevin with detailed code suggestions, but rather, vague suggestions. I stated clearly that my suggestion was from a Cocoa perspective on how to convert NSString to bytes, and

Re: Convert NSString to FSRef

2008-03-16 Thread Michael Ash
On Sun, Mar 16, 2008 at 5:41 AM, Nir Soffer [EMAIL PROTECTED] wrote: On Mar 16, 2008, at 10:11, stephen joseph butler wrote: On Sat, Mar 15, 2008 at 2:04 PM, Kevin Dixon [EMAIL PROTECTED] wrote: Also, is there a better way to accomplish this? There are a lot of buggy or

Re: Convert NSString to FSRef

2008-03-16 Thread Adam R. Maxwell
On Mar 16, 2008, at 11:15 AM, Michael Ash wrote: On Sun, Mar 16, 2008 at 5:41 AM, Nir Soffer [EMAIL PROTECTED] wrote: On Mar 16, 2008, at 10:11, stephen joseph butler wrote: On Sat, Mar 15, 2008 at 2:04 PM, Kevin Dixon [EMAIL PROTECTED] wrote: Also, is there a better way to accomplish

Convert NSString to FSRef

2008-03-15 Thread Kevin Dixon
I'm trying to write a method that will convert a NSString containing a file system URL to an FSRef with the following code - (FSRef)stringToFSRef: (NSString*)filePath { FSRef output; CFStringRef cfFilePath = CFStringCreateWithCString(NULL, [filePath cString],

Re: Convert NSString to FSRef

2008-03-15 Thread Adam R. Maxwell
On Mar 15, 2008, at 12:04 PM, Kevin Dixon wrote: I'm trying to write a method that will convert a NSString containing a file system URL to an FSRef with the following code - (FSRef)stringToFSRef: (NSString*)filePath { FSRef output; CFStringRef cfFilePath =

Re: Convert NSString to FSRef

2008-03-15 Thread Jean-Daniel Dupas
Le 15 mars 08 à 20:04, Kevin Dixon a écrit : I'm trying to write a method that will convert a NSString containing a file system URL to an FSRef with the following code - (FSRef)stringToFSRef: (NSString*)filePath { FSRef output; CFStringRef cfFilePath =

Re: Convert NSString to FSRef

2008-03-15 Thread Keith Duncan
-cString has been deprecated for a very long time; it's better to use UTF8String. Not all file systems support UTF8, you should use - fileSystemRepresentation instead for compatability. Keith ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Re: Convert NSString to FSRef

2008-03-15 Thread Adam R. Maxwell
On Mar 15, 2008, at 12:34 PM, Keith Duncan wrote: -cString has been deprecated for a very long time; it's better to use UTF8String. Not all file systems support UTF8, you should use - fileSystemRepresentation instead for compatability. For some APIs, but not in this case. The OP is