Created
July 31, 2012 11:20
-
-
Save wedesoft/3216298 to your computer and use it in GitHub Desktop.
Convert weird Mac OS file reference URL to a POSIX path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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