How do I start XCode (or any other default program associated with a file) and make it open a specific file programmatically? Similar to double-clicking a .c in Finder - it opens an XCode editor with the file.
There is a method called openFile:
on NSWorkspace
that does exactly this.
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class/Reference/Reference.html
(For bonus points, if you want to do it from the shell, you can use the open
command.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With