|
|
|
|
Re: Search IDL content with Spotlight (Mac OS X) [message #45396 is a reply to message #45300] |
Wed, 31 August 2005 16:02  |
mperrin+news
Messages: 81 Registered: May 2001
|
Member |
|
|
jm@dmu.ac.uk <jm@dmu.ac.uk> wrote:
> So, it would seem that we need some way to force Spotlight to seek out
> *.pro files, but I can't see any way of doing that.
It's a bit more complicated than one might want, but it can be done.
Spotlight (and Tiger in general) internally use a system called
Universal Type Identifiers (UTIs) for handling file types.
See John Siracusa's sprawling technical review of Tiger for more details:
http://arstechnica.com/reviews/os/macosx-10.4.ars
The simplest way to make Spotlight index an arbitrary text file is to hack
on the Apple-provided RichText.mdimporter (in /System/Library/Spotlight/)
There's a decent discussion of how to do this at
http://www.macosxhints.com/article.php?story=200505141825207 14
You can change which file types the importer will look at by editing
/System/Library/Spotlight/RichText.mdimporter/Contents/Info. plist
For file types with defined UTIs, it's as simple as adding that UTI
to the appropriate part of the plist file. For IDL .pro files it's a
little harder, since there isn't a well defined UTI. But it's not too hard
to define UTIs; it just requires yet more addition of appropriately-crafted
text into the same plist file. A description of how to do this is available
with Apple's Spotlight developer docs, but I'll save you the trouble, since
I had to figure it out a while ago for a different project (Spotlight
indexing of astronomical FITS files).
I've put a modified version of RichText's Info.plist file online at
http://astron.berkeley.edu/~mperrin/software/Info.plist
If you download that and replace the one inside RichText.mdimporter with that,
Spotlight will start indexing .pro files for you.
Files will be indexed whenever they are saved or modified, or you can
manually import them with the "mdimport" command.
Give it a shot and let me know if you have any problems. I've just tested
it out on my own computer, but I don't think there are any bugs
(famous last words, yes. :-)
- Marshall
|
|
|
Re: Search IDL content with Spotlight (Mac OS X) [message #45397 is a reply to message #45300] |
Wed, 31 August 2005 15:06  |
K. Bowman
Messages: 330 Registered: May 2000
|
Senior Member |
|
|
In article <1125520674.079332.234490@g47g2000cwa.googlegroups.com>,
jm@dmu.ac.uk wrote:
> I think that IDL indexes files primarily by type, or at least filename.
> I tried the following:
>
> ln -s foo.pro foo.txt
>
> No effect - Spotlight doesn't pick-up on the file contents. However,
>
> cp foo.pro foo.txt
>
> results in a file (foo.txt) that Spotlight has indexed (instantly).
> Evidently, the recognition that Spotlight uses in this instance is
> based entirely on the file name. What's more, it's needs to be a copy
> rather than a link (even if the soft-link worked, that would hardly be
> an elegant solution).
>
> So, it would seem that we need some way to force Spotlight to seek out
> *.pro files, but I can't see any way of doing that.
>
> -John Mardaljevic
Hmmm, I don't have any problem with Spotlight searching my .pro files. They are
all within my home directory.
Ken Bowman
|
|
|