[MacRuby-devel] [macruby] #95: uninitialized constant NSHomeDirectory

macruby ruby-noreply at macosforge.org
Mon Jul 7 12:06:10 PDT 2008


#95: uninitialized constant NSHomeDirectory
------------------------------------+---------------------------------------
 Reporter:  jonathan at waddilove.net  |        Owner:  lsansonetti at apple.com
     Type:  defect                  |       Status:  closed               
 Priority:  minor                   |    Milestone:                       
Component:  MacRuby                 |   Resolution:  invalid              
 Keywords:                          |  
------------------------------------+---------------------------------------
Changes (by lsansonetti at apple.com):

  * status:  new => closed
  * resolution:  => invalid

Comment:

 Do not forget to load the Cocoa framework first (loading only Foundation
 should work too), then since NSHomeDirectory is actually a C function, and
 that it starts with a capital letter, Ruby needs you to specify the
 parentheses otherwise it will think it's a constant.

 {{{
 $ macirb
 >> NSHomeDirectory
 NameError: uninitialized constant NSHomeDirectory
         from (irb):1
         from /usr/local/bin/macirb:12:in `<main>'
 >> framework 'Cocoa'
 => true
 >> NSHomeDirectory
 NameError: uninitialized constant NSHomeDirectory
         from (irb):3
         from /usr/local/bin/macirb:12:in `<main>'
 >> NSHomeDirectory()
 => "/Users/lrz"
 >>
 }}}

-- 
Ticket URL: <https://www.macruby.org/trac/ticket/95#comment:1>
macruby <http://macruby.org/>


More information about the MacRuby-devel mailing list