Post by mhzHow to Open a Finder window showing the folder from the BSD directory path in Cocoa
Here is some actual, tested, working, source code:
NSString* path = @"/Developer/Applications";
NSString* scriptString = [NSString stringWithFormat:
@"tell application \"Finder\" to open posix file \"%@\"", path];
NSAppleScript* script =
[[NSAppleScript alloc] initWithSource: scriptString];
NSDictionary* errorDict = nil;
[script executeAndReturnError: &errorDict];
[script release];
Obviously, in a real program:
You'd want to look at the autoreleased errorDict from
executeAndReturnError.
You'd need to process 'path' to escape any backslashes and double quote
characters in it.
David Phillip Oster