[MacRuby-devel] spotlight - MDItemRef

Alan Skipp al_skipp at fastmail.fm
Tue Oct 27 17:13:17 PDT 2009


Would anyone be able to give me a hint on how to get the following
objective-c code working with macruby. The code uses spotlight to
extract metadata from a file.

MDItemRef inspectedRef =
MDItemCreate(kCFAllocatorDefault,(CFStringRef)path);
CFArrayRef attributeNames = MDItemCopyAttributeNames(inspectedRef);
	
NSLog(@"%@", (NSArray*)attributeNames);


I was hoping that including the 'CoreServices' framework would work, but
no joy.

>> framework 'CoreServices'
=> true
>> item = MDItemCreate(KCFAllocatorDefault, '/Users/alan/Desktop/test.jpg')
NameError: uninitialized constant KCFAllocatorDefault
	from core:in `const_missing:'
	from (irb):2:in `<main>'
	from core:in `eval:'
	from core:in `evaluate:'
-- 
  Alan Skipp
  al_skipp at fastmail.fm

-- 
http://www.fastmail.fm - IMAP accessible web-mail



More information about the MacRuby-devel mailing list