• 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: [Cocoa] How convert ":Developer:Private:jam" into a path POSIX-style
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Cocoa] How convert ":Developer:Private:jam" into a path POSIX-style


  • Subject: Re: [Cocoa] How convert ":Developer:Private:jam" into a path POSIX-style
  • From: Uli Kusterer <email@hidden>
  • Date: Fri, 20 Apr 2007 10:00:24 +0200

Am 20.04.2007 um 09:35 schrieb donaldo donaldo:
Thx but I don't understand how convert a path HFS into a path POSIX.

Look at the headers "CFURL.h" and "CFString.h" (just type each of those file names into "Open Quickly" and you should get them -- you can also just google for those terms on Apple's developer.apple.com web site to see the documentation). Presuming you have a C-string containing your path, you'd do:


-> create a CFStringRef from your path (encoding of HFS paths is MacRoman!)
-> create a CFURLRef from the CFString containing your file system path
-> Extract the file system path from the CFURLRef again, but this time specify POSIX path style, not HFS path style.
-> Now you'll have a CFString. Apple guarantees you that CFStrings will be the same as NSStrings, so you can just do:


NSString* myString = (NSString*) myCFString; and from then on use the CFString just like any NSString. Note that you'll have to release any objects created using functions with "Create" or "Copy" in their names (using CFRelease, or in the case of CFURLRefs and CFStringRefs, which are just different names for NSURL* and NSString*, you can also use release or autorelease).

If you didn't have a C string in the beginning, you may have to do some more conversion, or if it's already an NSString* cou can skip the first step.

Cheers,
-- M. Uli Kusterer
http://www.zathras.de



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >[Cocoa] How convert ":Developer:Private:jam" into a path POSIX-style (From: "donaldo donaldo" <email@hidden>)
 >Re: [Cocoa] How convert ":Developer:Private:jam" into a path POSIX-style (From: "Finlay Dobbie" <email@hidden>)
 >Re: [Cocoa] How convert ":Developer:Private:jam" into a path POSIX-style (From: "donaldo donaldo" <email@hidden>)

  • Prev by Date: Re: [Cocoa] How convert ":Developer:Private:jam" into a path POSIX-style
  • Next by Date: Re: Blank help files
  • Previous by thread: Re: [Cocoa] How convert ":Developer:Private:jam" into a path POSIX-style
  • Next by thread: Re: [Cocoa] How convert ":Developer:Private:jam" into a path POSIX-style
  • Index(es):
    • Date
    • Thread