Reputation: 6247
I am using NSAppleScript to run applescript from within my application. My problem is that I have an NSURL that I want converted to string. When I convert it, I get: path/to/my/file, but applescript requires path:to:my:file. How can I convert my NSURL into this format? THanks.
Upvotes: 2
Views: 1413
Reputation: 6932
You might find this useful it will convert the pathString to a HFS style path (with colons):
NSString* pathString = [@"~/Desktop/Home.m4v" stringByExpandingTildeInPath];
NSURL* theFileURL = [NSURL fileURLWithPath:pathString];
NSString* path = [(NSString*)CFURLCopyFileSystemPath((CFURLRef)theFileURL, kCFURLHFSPathStyle) autorelease];
NSLog(@"path= %@",path);
Upvotes: 4