[MacRuby-devel] [MacRuby] #607: macruby_main() argv transformation prevents passing arguments to the Ruby app

MacRuby ruby-noreply at macosforge.org
Mon Feb 8 07:35:11 PST 2010


#607: macruby_main() argv transformation prevents passing arguments to the Ruby
app
---------------------------------+------------------------------------------
 Reporter:  honglilai@…          |       Owner:  lsansonetti@…        
     Type:  defect               |      Status:  new                  
 Priority:  blocker              |   Milestone:                       
Component:  MacRuby              |    Keywords:                       
---------------------------------+------------------------------------------
 I have a MacRuby Cocoa app named FooBar, but I cannot pass any arguments
 to the program:

 {{{
 ./build/Debug/FooBar.app/Contents/MacOS/FooBar 0
 }}}

 I get:

 {{{
 No such file or directory -- 0 (LoadError)
 }}}

 It turns out that macruby_main() transforms the argv array incorrectly. At
 this time it transforms the original argv into something like this:

 {{{
 argv[0 .. argc - 1] = original argv values
 argv[argc + 0] = -I/path-to-app-dir/(...)/Resources
 argv[argc + 1] = main .rb file
 }}}

 This causes any command line arguments to be recognized as interpreter
 arguments, not app arguments. The attached patch changes the
 transformation into something like this:

 {{{
 argv[0] = original value
 argv[1] = -I/path-to-app-dir/(...)/Resources
 argv[2] = main .rb file
 argv[3 .. N] = rest of original argv
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/607>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list