Content search through source code in finder

1

I am using OSX 10.6 and want to have content searches in finder for the source code types i use. This suggests a (10.4 only?) solution, but although i have the developer tools installed i don't have /Library/Spotlight/SourceCode.mdimporter.

Is there a different procedure for Snow Leopard or did i miss something?

Edit:
This looks better, but how to register new file types which don't have UTIs yet?

Edit2:
To clarify - i am ok with a simple plain text search through these files...

gfr

Posted 2010-03-27T12:25:06.880

Reputation: 113

What types of text files are you using that aren't already being indexed? – Hasaan Chop – 2010-03-27T20:20:04.060

Currently e.g. .cmake . – gfr – 2010-03-28T00:03:08.333

Answers

1

So it seems your problem is not in getting Spotlight to add something as much as getting the OS to see that .cmake files are plain text.

From the first edit I'm guessing that mdimport -n -d1 somefile.cmake isn't returning anything useful (If it is just add that type).

If it's not, try mdimport -d1 *.cmake public.plain-text or something similar.

Since I don't have any cmake files I can't test this.

Chris

Posted 2010-03-27T12:25:06.880

Reputation: 111

mdimport -n -d1 foo.cmake doesn't output anything. As for mdimport -d1 *.cmake public.plain-text - is there a better way to do this globally then say a recursive find -exec? Can't i add file extensions that should always be automatically indexed as plain text? – gfr – 2010-03-30T19:49:53.783

I couldn't find one. As someone mentioned, you could write your own Spotlight plugin, but that seems like a lot of work.

Personally, I would either put something in cron, or add an entry to your makefile to do it. – Chris – 2010-04-01T16:13:42.643

0

It already works fine in 10.6 for common source code file types, e.g. .c, .h, etc.

Paul R

Posted 2010-03-27T12:25:06.880

Reputation: 4 717

And for those which aren't yet supported? – gfr – 2010-03-27T21:12:04.273

0

You'll need to produce your own Spotlight plugin which defines a UTI for those files and hands them off as plain text. You can also try editing an existing importer, but since they're all code signed now, that may or may not break something important.

cmake is generally more trouble than it's worth.

Hasaan Chop

Posted 2010-03-27T12:25:06.880

Reputation: 4 224