[MacRuby] #1370: __FILE__ is different for compiled code
MacRuby
ruby-noreply at macosforge.org
Fri Jul 29 08:28:15 PDT 2011
#1370: __FILE__ is different for compiled code
------------------------------------+---------------------------------------
Reporter: mrada@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: blocker | Milestone:
Component: MacRuby | Keywords: reduction
------------------------------------+---------------------------------------
Use of the special __FILE__ variable changes between the JIT and AOT
version of its usage. When using AOT code, only the name of the file is
given, not the full path.
Demo code:
{{{
def bug!
puts __FILE__
puts File.dirname(__FILE__)
puts File.expand_path(__FILE__)
end
bug!
Dir.chdir '/Users/Shared' do bug! end
Dir.chdir '/Library/LaunchDaemons' do bug! end
}}}
First run the code using JIT, the same output will be repeated for each
directory change. Then compile the code using macrubyc and run the
compiled version, the output will be different each time.
JIT:
{{{
/Users/mrada/bug3.rb
/Users/mrada
/Users/mrada/bug3.rb
/Users/mrada/bug3.rb
/Users/mrada
/Users/mrada/bug3.rb
/Users/mrada/bug3.rb
/Users/mrada
/Users/mrada/bug3.rb
}}}
AOT:
{{{
bug3.rb
.
/Users/mrada/bug3.rb
bug3.rb
.
/Users/Shared/bug3.rb
bug3.rb
.
/Library/LaunchDaemons/bug3.rb
}}}
--
Ticket URL: <http://www.macruby.org/trac/ticket/1370>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list