Can I store a screensaver inside my App bundle?
I have a Mac app that can double as a screensaver (a minor functionality, but which I enjoy!). I don't want to have to distribute the app itself (a fractal viewer) and the screensaver separately, so I want to pu开发者_JAVA技巧t the screensaver bundle inside the app bundle.
Questions: can I do that, and expect it to work? Do I have to "register" the screensaver somehow (using which API?), or will it be picked up automagically by the system?
I don't think the OSX screen saver host will acknowledge your .saver
bundle unless it's in one of the Library/Screen Savers
directories. So you can't just distribute the app and expect the saver to run with no further intervention.
You can still distribute them as a single bundle, of course, but you'll need to have some way of copying or symlinking the .saver
into the right place from wherever it lives inside your app. For example, you could offer the user that option the first time they run your app, or you could add an "Install Screen Saver" menu item, or whatever.
I doubt you can do it without any user intervention at all -- as well as being rude, that would probably represent a bit of security hole...
You can do this without user intervention. At startup of your app, you can copy the .saver out of your bundle and into the "~/Library/Screen Savers" directory. The next time you run System Preferences and go to the screen saver settings, you should see your screensaver listed with the built in screensavers.
Beware that if the user doesn't expect that you are installing a screensaver, they might get irritated.
So, apparently no way around this.
精彩评论