1

I want to convert /Users/Irwan/Documents/test.jpg into MyMac:Users:Irwan:Documents:test.jpg I can do that manually but I wonder if there is easy way to do it ?

thanks

Irwan
  • 783
  • 1
  • 13
  • 28
  • What are you trying to generate the colon-separated path for? I don't believe it's used by any modern APIs. –  Jun 15 '11 at 06:13

1 Answers1

5
NSURL *url = [NSURL fileURLWithPath:path];
path = (NSString *)CFURLCopyFileSystemPath((CFURLRef)url, kCFURLHFSPathStyle);
[path autorelease];
Jens Ayton
  • 14,532
  • 3
  • 33
  • 47
  • Ooo, nice. I looked at `CFString` and found nothing; should’ve looked at `CFURL`, too. –  Jun 15 '11 at 06:36