[MacRuby-devel] spotlight - MDItemRef

John Shea johnmacshea at gmail.com
Wed Oct 28 02:49:21 PDT 2009


I always assumed (with no direct evidence) that it was because in  
Ruby, constants have to start with an uppercase letter, and so to  
match various method signatures/types sent through BridgeSupport,  
constant types must be passed as constant types.

Anyway for supported frameworks capitalising the constant always seems  
to work.

BridgeSupport is an amazing piece of work in my opinion - worksk (and  
work very well) almost transparent to the developer.

Actually am just assuming that the new Applescript methods use  
BridgeSupport? In which case BridgeSupport should just get better.

HTH
J


On Oct 28, 2009, at 10:31 , Allison Newman wrote:

> I'm probably asking a really dumb question here - but I haven't used  
> bridgesupport very much...
> Is there a reason why the constant in the example that fails starts  
> with an upper case K, rather than keeping the lower case k given in  
> the framework?
>
> Alli
>
> On Wednesday, October 28, 2009, at 01:31AM, "Laurent Sansonetti" <lsansonetti at apple.com 
> > wrote:
>> Hi Alan,
>>
>> I'm afraid the MD* APIs haven't been covered by BridgeSupport yet, so
>> it may not be possible to call it directly from MacRuby at this  
>> point.
>> I would recommend to file a bug at http://bugreporter.apple.com so
>> that we can consider this for a future Mac OS X release, and to wrap
>> this C API into an Objective-C class that you can call from MacRuby  
>> in
>> the meantime.
>>
>> Laurent
>>
>> On Oct 27, 2009, at 5:13 PM, Alan Skipp wrote:
>>
>>> 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
>>>
>>> _______________________________________________
>>> MacRuby-devel mailing list
>>> MacRuby-devel at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel



More information about the MacRuby-devel mailing list