Database Reference
In-Depth Information
which we accomplish by running our application. Once the metadata files
are created, we can test the importer.
We can get a lot of information about our importer directly on the command
line. Mac OS X includes a command-line tool called mdimport . A quick review
of the man page reveals there are three switches for this command that are
of immediate use. First, we need to tell Spotlight to load our importer.
mdimport -r ${path to our project}/build/Debug/GrokkingRecipes.app/
Contents/Library/Spotlight/SpotlightPlugin.mdimporter
Once Spotlight is aware of our importer, we can start querying it, again from
the command line using the mdimport command.
cd ~/Library/Caches/Metadata/GrokkingRecipes
mdimport -d2 Test.grokkingrecipe
We can change the debug level from 1 to 4 to display different quantities of
information about the metadata file. Level 2 tells us that the importer is
working and gives us a basic summary of the data contained inside the file.
The other way to test the importer is to just search for one of our recipes!
Click the spotlight magnifying glass in the upper-right corner, and enter the
name of one of the recipes, as in Figure 39, The Pot Roast recipe in Spotlight ,
on page 167 . But what happens when we try to open this file?
Figure 39—The Pot Roast recipe in Spotlight
Accepting Metadata Files
Since we linked our metadata files to the primary application, Mac OS X
attempts to open our application and pass the file to us. However, we have
no way of handling that yet.
 
 
 
Search WWH ::




Custom Search