On Sat, Sep 20, 2008 at 12:57 PM, Tommy Nordgren
<[EMAIL PROTECTED]> wrote:
>        Use NSTask with the command line find -x /  -name '*.app'
> Do this on a separate thread, and cache the result.

I highly recommend against this approach. One problem is that it will
fail badly if any of the returned paths contain the \n character,
which is a perfectly legal path character. For another it will fail if
the new process would exceed the user's process limit, a limit which
tends to be much lower than most other resource limits and thus much
easier to encounter in realistic situations.

For the original problem, I'd recommend using something like
LSCopyApplicationURLsForURL() if it's at all possible. Of course maybe
you have data that isn't good for that, but if you can use it then
that's the way to go.

If you must search the disk, use Spotlight if you can. It will be
vastly faster than anything else. The downside is that it won't work
if indexing is disabled or if the desired application is in an
excluded directory.

If you must search the whole disk without Spotlight, use
NSDirectoryEnumerator. Or if you're the sort who likes to use
unsupported private functions, you may be interested in the discussion
near the bottom of http://www.cocoadev.com/index.pl?AllApplications

Mike
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to