Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
XCode(またはファイルに関連付けられている他のデフォルトプログラム)を起動して、プログラムで特定のファイルを開くにはどうすればよいですか?Finderで.cをダブルクリックするのと同様に、ファイルを含むXCodeエディタが開きます。
まさにこれを行うopenFile:onというメソッドがあります。NSWorkspace
openFile:
NSWorkspace
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace_Class/Reference/Reference.html
(おまけとして、シェルから実行する場合は、コマンドを使用できますopen。)
open
open your-file.extシェルまたはシェル スクリプトから実行すると、ファイルをダブルクリックしたかのように、Finder がデフォルトの関連付けられたアプリでファイルを開きます。
open your-file.ext
man 1 open
オープンの仕組みの詳細については。