Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I programmatically tell if Spotlight is enabled?

I'm using the Spotlight API (NSSMetadataQuery) in my application. I want to display a helpful note to the user if they try to do something that would do a Spotlight query on a volume which isn't indexed.

I can determine this in a terminal by running "mdutil -s /Volumes/Foo".

Is there an API which returns this information, that doesn't require running an external program?

like image 847
user3642070 Avatar asked May 15 '14 18:05

user3642070


1 Answers

Seems as though there's neither a documented method or written solution out there. The same question has been asked before to no avail on Apple's Mailing List, so I guess using NSTask and parsing the output (my rough sample code linked) would be one way to go about getting this information from a Cocoa app/programatically.

like image 123
Seb Jachec Avatar answered Oct 10 '22 09:10

Seb Jachec