From: Knud H. M. <knu...@de...> - 2008-04-14 18:44:57
|
Hi, how does one call methods like -[NSFileManager fileExistsAtPath:isDirectory:] from Ruby, where the second parameter is a pointer (in this case to a BOOL)? The Obj-C use is like this: BOOL isDir; NSFileManager *fileManager = [NSFileManager defaultManager]; if ([fileManager fileExistsAtPath:@"/bla/blub" isDirectory:&isDir] && isDir) { doSomething(); // ... My naive attempt at using this from Ruby: isDirectory = FALSE OSX::NSFileManager.defaultManager.fileExistsAtPath_isDirectory?(path, isDirectory) if (isDirectory) doSomething ... end As expected, this doesn't work. I get: KNTileViewerAppController#scanDirectory: OSX::OCDataConvException: Cannot convert the argument #1 as '^B' to Objective-C /System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/ objc/oc_wrapper.rb:50:in `ocm_send' /System/Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/ objc/oc_wrapper.rb:50:in `method_missing' Any suggestions? Cheers, Knud ------------------------------------------------- Knud Möller, MA +353 - 91 - 495086 Smile Group: http://smile.deri.ie Digital Enterprise Research Institute National University of Ireland, Galway Institiúid Taighde na Fiontraíochta Digití Ollscoil na hÉireann, Gaillimh |