• 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: Stefan Werner <email@hidden>
  • Date: Fri, 20 Apr 2007 09:37:03 -0700


On 20.04.2007, at 08:48, donaldo donaldo wrote:

Thx
My code :

char path[500] = "mypath";
CFStringRef urlString = (NSString *) path;
CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, urlString,
kCFURLHFSPathStyle, YES);
CFStringRef resultString = CFURLCopyFileSystemPath
(url,kCFURLPOSIXPathStyle);
NSString* myString = (NSString*) resultString;


The second line should read:
CFStringRef urlString = CFStringWithCString(kCFAllocatorDefault, path, kCFStringEncodingMacRoman);
and then you must later release it with CFRelease(urlString);


Replace the kCFStringEncodingMacRoman with the proper encoding if your string is not MacRoman encoded. But in general, most if not all Mac OS functions that deal with HFS Paths use MacRoman encoding on Western versions of the OS.

Stefan
_______________________________________________

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


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

  • Prev by Date: Re: NSOpenPanel -runModalForDirectory:file:types: won't select file
  • Next by Date: Filtering of large dataset
  • 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