[jira] Created: (JRUBY-4220) File.dirname(__FILE__) doesn't return correct value when a script is loaded from classpath

View: New views
1 Messages — Rating Filter:   Alert me  

[jira] Created: (JRUBY-4220) File.dirname(__FILE__) doesn't return correct value when a script is loaded from classpath

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

                 Key: JRUBY-4220
                 URL: http://jira.codehaus.org/browse/JRUBY-4220
             Project: JRuby
          Issue Type: Bug
          Components: Embedding
    Affects Versions: JRuby 1.5
            Reporter: Yoko Harada


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:
{noformat}
[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
{noformat}

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

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email