jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • JRuby
  • JRUBY-4220

File.dirname(__FILE__) doesn't return correct value when a script is loaded from classpath

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.5
  • Fix Version/s: JRuby 1.7.0.pre1
  • Component/s: Embedding
  • Labels:
    None

Description

When a script is loaded from classpath, File.dirname(_FILE_) returns the base directory. Because of this behavior, test_dir.rb test_file.rb test_io.rb, and test_load_class_before_rb.rb fail. For example, test_io.rb outputs:

[junit] [test_io.rb]
    [junit] Loaded suite -
    [junit] Started
    [junit] test_io.rb:71 warning: syswrite for buffered IO
    [junit] .........F...................
    [junit] Finished in 0.435 seconds.
    [junit] 
    [junit]   1) Failure:
    [junit] test_io_reopen(TestIO) [test_io.rb:450]:
    [junit] <"foo"> expected but was
    [junit] <"Error opening script file: /Users/yoko/DevSpace/jruby~main/./quiet.rb (No such file or directory)">.
    [junit] 
    [junit] 29 tests, 108 assertions, 1 failures, 0 errors

All of those test scripts work well without errors when those are read from absolute path.

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Hiro Asari added a comment - 22/Apr/12 1:20 AM

This seems to be fixed on master.

Show
Hiro Asari added a comment - 22/Apr/12 1:20 AM This seems to be fixed on master.

People

  • Assignee:
    Unassigned
    Reporter:
    Yoko Harada
Vote (2)
Watch (2)

Dates

  • Created:
    06/Nov/09 12:35 PM
    Updated:
    22/Apr/12 1:20 AM
    Resolved:
    22/Apr/12 1:20 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.