Re: Getting a list of all the applications available on the harddrive
Re: Getting a list of all the applications available on the harddrive
- Subject: Re: Getting a list of all the applications available on the harddrive
- From: Jerry Krinock <email@hidden>
- Date: Wed, 26 Oct 2005 21:12:17 -0700
- Thread-topic: Getting a list of all the applications available on the harddrive
on 05/10/26 14:06, Andrew Bush at email@hidden wrote:
> how do I do this? I found [NSWorkspace findApplications], but that
> doesn't actually return anything
Indeed, it's declared as (void)!
I think that you need to search your hard drive, and according to my
Cocoabuilder+Google "research" I did several weeks ago, the only way to do
this with any reasonable speed is to use the Carbon function FSCatalogSearch
or one of its sisters.
This ain't easy chief, especially if you are accustomed to the comparatively
excellent documentation of Cocoa. Fortunately, I spent a support incident a
couple months ago to get some questions answered and wrapped this in a
command-line tool which you could package in with your project, call it and
read the answer from stdout using NSTask. Or, if you don't mind tying up
your app for some tens of seconds or launching in a new thread, you can copy
the code into your files somewhere. Here is a link to the project file with
all source code:
http://www.sheepsystems.com/carbonSearch
To find all directories containing ".app" in their name, invoke the
deployment build with:
CarbonSearch -d .app
Invoke it with no arguments to get a short "manual" explaining other
possibilities.
Note that FSCatalogSearch and thus CarbonSearch can only search an entire
volume. If on the other hand you want to search only certain directories,
for example /Applications, then, I am told, you should use the "Bulk" APIs
such as GetCatalogInfoBulk(), and I am told that you can get this by
including MoreFilesX.c in your project and calling FSIterateContainer().
http://developer.apple.com/samplecode/MoreFilesX/MoreFilesX.html
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden