[MacRuby-devel] "framework" method gotcha

Matt Aimonetti mattaimonetti at gmail.com
Sat Mar 12 20:35:29 PST 2011


Hi Christian,

As long as performance isn't affected, I think that making #framework smarter shouldn't be a problem. 

- Matt

Sent from my iPhone

On Mar 12, 2011, at 17:19, Christian Niles <christian at nerdyc.com> wrote:

> Hey All,
> 
> I just spent a few hours banging my head against a gotcha with the `framework` method -- if there happens to be a file or directory in the current directory with the name of the framework, the method fails:
> 
> $ touch Cocoa
> $ macruby -e 'framework "Cocoa"'
> -e:1:in `<main>': framework at path `Cocoa' cannot be located (RuntimeError)
> 
> $ rm Cocoa; mkdir Cocoa
> $ macruby -e 'framework "Cocoa"'
> -e:1:in `<main>': framework at path `Cocoa' cannot be loaded: Error Domain=NSCocoaErrorDomain Code=4 UserInfo=0x200241e20 "The bundle “Cocoa” couldn’t be loaded because its executable couldn’t be located."
> 
> I ran into this while trying to setup unit testing for a Cocoa framework I'm writing. XCode 4 automatically creates a directory for each target you create. Thus, when I tried to load my framework, it saw my project target directory and thought it had found the framework.
> 
> I think the `framework` method should be updated to avoid this gotcha. Currently, it just tests for existence of a file or directory. I'm happy to start working on a patch, but wanted to ask if there's any possible reason the `framework` method is this naïve?
> 
> christian.
> _______________________________________________
> 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