Can I programmatically determine if Spotlight is on?

I am using the Spotlight API (NSSMetadataQuery) in my application. I want to show the user a useful note if they try to do something that will make the Spotlight query on the one that is not indexed.

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

Is there an API that returns this information that does not require running an external program?

+6
source share
1 answer

It seems that there is no documentary method, no written decision. The same question was asked before you could say anything about the Apple mailing list , so I think using NSTask and output parsing (my sample code) would be one way to get this information from a Cocoa / application programmatically.

+1
source

Source: https://habr.com/ru/post/969349/


All Articles