Skip to content

Instantly share code, notes, and snippets.

@wedesoft
Created July 31, 2012 11:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wedesoft/3216298 to your computer and use it in GitHub Desktop.
Save wedesoft/3216298 to your computer and use it in GitHub Desktop.
Convert weird Mac OS file reference URL to a POSIX path
#import <Foundation/Foundation.h>
#import <Foundation/NSUrl.h>
#import <Foundation/NSString.h>
// file_reference_url.mm: convert weird Mac OS file reference URL to a file URL
// Compilation:
// gcc -o file_reference_url file_reference_url.mm -framework Cocoa
// Example:
// ./file_reference_url file:///.file/id=6571367.15106761
int main( int argc, const char *argv[] ) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog(@"url = %@", [[[NSURL URLWithString: [NSString stringWithUTF8String: argv[1]]] filePathURL] absoluteString]);
[pool release];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment