开发者

Limit scope of NSMetadataQuery

I was trying to restrict the scope of an NSMetadataQuery item. I know there's 开发者_如何转开发the -setSearchScope: method (see the docs), but it lets me only decide in which directories the item will search.

What if I need to exclude one or more directories from the scope?


Unfortunately, I don't believe this is possible, since the kMDItemPath attribute is not indexed by Spotlight, and is therefore not usable in a query.

File a bug.


One way would be to set all the include paths in the setSearchScope array, leaving out what you don't want. Of course that is only good if you know those ahead of time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜