开发者

Limit scope of NSMetadataQuery

开发者 https://www.devze.com 2023-01-19 14:28 出处:网络
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 wil

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

精彩评论

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