• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Convert NSString to FSRef
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convert NSString to FSRef


  • Subject: Re: Convert NSString to FSRef
  • From: "Adam R. Maxwell" <email@hidden>
  • Date: Sun, 16 Mar 2008 11:38:58 -0700


On Mar 16, 2008, at 11:15 AM, Michael Ash wrote:

On Sun, Mar 16, 2008 at 5:41 AM, Nir Soffer <email@hidden> wrote:

On Mar 16, 2008, at 10:11, stephen joseph butler wrote:

On Sat, Mar 15, 2008 at 2:04 PM, Kevin Dixon <email@hidden> 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:


The code you mention will not work for this case - Kevin asked how to
convert a url string to FSRef, not a file system path.

The first answer by Adam R. Maxwell is correct and simple:


NSURL *aURL = [NSURL fileURLWithPath:filePath]; CFURLGetFSRef((CFURLRef)aURL, &output);

If in fact he really does have a string containing a file system URL and not just a string containing a path, then no, this is not correct. The URL creation should be [NSURL URLWithString:fileURL].

Yeah, I didn't think to mention that, since the parameter was "filePath" in the OP's code. The link stephen provided returns a BOOL (which I did remember to suggest!), so that's a good solution if you like categories.


--
adam
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >Convert NSString to FSRef (From: "Kevin Dixon" <email@hidden>)
 >Re: Convert NSString to FSRef (From: "stephen joseph butler" <email@hidden>)
 >Re: Convert NSString to FSRef (From: Nir Soffer <email@hidden>)
 >Re: Convert NSString to FSRef (From: "Michael Ash" <email@hidden>)

  • Prev by Date: Re: Convert NSString to FSRef
  • Next by Date: Re: CA: How to wait for an animation to finish?
  • Previous by thread: Re: Convert NSString to FSRef
  • Next by thread: Re: Convert NSString to FSRef
  • Index(es):
    • Date
    • Thread