How do do a Spotlight query that's language independent?

275 Views Asked by At

I want to do a Spotlight query to find the Aperture libraries on the local hard drives. A very simple way would be to use kMDItemKind but its value depend on the current user language:

kMDItemKind =     {
    "" = Library;
    de = "Aperture-Mediathek";
    en = "Aperture Library";
    fr = "Phototh\U00e8que Aperture";
    ja = "Aperture \U30e9\U30a4\U30d6\U30e9\U30ea";
    "zh-Hans" = "Aperture \U8d44\U6599\U5e93";
}

So how do you do a query that's language independent?

mdfind "kMDItemKind == 'Library'" > returns nothing

mdfind "kMDItemKind == 'Aperture Library'" > works fine

2

There are 2 best solutions below

0
On BEST ANSWER
mdfind "kMDItemContentTypeTree==XXX"

should do that, with XXX being something listed in the kMDItemContentTypeTree for Aperture Files.

0
On

You can also use the name extension ".aplibrary"

mdfind "kMDItemContentTypeTree == 'com.apple.package' && kMDItemFSName == '*.aplibrary'" 

iPhoto libraries and Aperture libraries is "com.apple.package"