Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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