2009-09-24 62 views
2

我想寫一個小的可可應用程序,幫助我管理我的時間,我希望它在啓動時檢查,如果已經有一個launchd條目,並且如果沒有,則添加一個條目。我的應用程序應該寫入其launchd文件的文件夾是什麼?

什麼是寫入launchd文件的正確文件夾,和/或是否有一個特殊的可可方法來檢索正確的文件夾是什麼(即以同樣的方式檢索用戶文檔文件夾),或者你只是假設一個以下硬編碼位置?

手冊頁列出了以下可能的URL我可能想使用〜/ Library/LaunchAgents?

~/Library/LaunchAgents   Per-user agents provided by the user. 
/Library/LaunchAgents   Per-user agents provided by the administrator. 
/Library/LaunchDaemons   System-wide daemons provided by the administrator. 
/System/Library/LaunchAgents Per-user agents provided by Mac OS X. 
/System/Library/LaunchDaemons System-wide daemons provided by Mac OS X. 

回答

3

如果您的應用將與用戶交互,您可能需要〜/ Library/LaunchAgents。我不知道Cocoa方法會爲你返回這個路徑。

上有代理和守護進程的詳細技術說明,你或許應該看看:

http://developer.apple.com/mac/library/technotes/tn2005/tn2083.html

+1

「代理和守護程序」聽起來像丹·布朗小說的標題。 – Alex 2009-09-24 13:19:18

+0

@亞歷山大 - 他們在那裏模仿一些嚴重的潛力。 – Abizern 2009-09-25 10:35:27

相關問題