[MacRuby-devel] [MacRuby] #558: unable to require files.

MacRuby ruby-noreply at macosforge.org
Wed Jan 13 13:34:05 PST 2010


#558: unable to require files.
-----------------------------+----------------------------------------------
 Reporter:  tvmoore@…        |       Owner:  lsansonetti@…        
     Type:  defect           |      Status:  new                  
 Priority:  blocker          |   Milestone:  MacRuby 0.5          
Component:  MacRuby          |    Keywords:                       
-----------------------------+----------------------------------------------
 lib_file =
 File.join(File.expand_path($0).slice(0,File.expand_path($0).index("dmdnlib")),
 "dmdnlib/lib/lib")
 require "#{lib_file}"

 The result from this is students-v-ldap.rb:in `<main>': no such file to
 load /Volumes/DMDNTech/scripts/ruby/dmdnlib/lib/lib.rb (LoadError)

 I have tried to load said lib.rb by requiring in macirb with an explicit
 path.

 irb(main):002:0> require '/Volumes/DMDNTech/scripts/ruby/dmdnlib/lib/lib'
 LoadError: no such file to load --
 /Volumes/DMDNTech/scripts/ruby/dmdnlib/lib/lib.rb

 macruby /Volumes/DMDNTech/scripts/ruby/dmdnlib/lib/lib.rb runs without any
 errors...

 I need this to work as lib.rb apart from some globals puts all of my
 library folders into the load path.

 Dir.glob("#{$DMDN_ENV[:root]}/**/**").each do |f|
   next if !File.directory?(f)
   next if f =~ /\.app/
   $LOAD_PATH << f
 end

 I then only ever need to use require 'x' instead of an explicit path.

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



More information about the MacRuby-devel mailing list