Actions
Bug #3799
closedUnexpected behaviour of require_relative
Description
=begin
I have this code written to handle ruby 1.8 and 1.9.2:
#!/usr/bin/env ruby
library = '/../lib/forex/hll_forex_ca_feed' if RUBY_VERSION < '1.9.2' require File.dirname(__FILE__) + library else require_relative File.dirname(__FILE__) + '/..' + library end HLLForexCAFeed::Main.new(ARGV).execute
This code works with 1.8.6+ and 1.9.2. However, please note the insertion of an additional directory reverse traversal. If I do not provide this to Ruby-1.9.2 then the require fails with this error:
$ bin/forex bin/forex:8:in `require_relative': no such file to load -- /home/byrnejb/Software/Development/Projects/proforma.git/bin/lib/forex/hll_forex_ca_feed (LoadError) from bin/forex:8:in `
My question is: Why does Ruby-1.9.2-p0 require the additional backtrack?
=end
Actions
Like0
Like0Like0Like0