Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__dir__ does not return canonicalized absolute path #4689

Closed
jakago opened this Issue Jun 27, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@jakago
Copy link

jakago commented Jun 27, 2017

blah.rb

p __dir__
p File.dirname(File.realpath(__FILE__))

Environment

jruby 9.1.12.0 (2.3.3) 2017-06-15 33c6439 Java HotSpot(TM) 64-Bit Server VM 25.121-b13 on 1.8.0_121-b13 +jit [darwin-x86_64]

Darwin mac-mini.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Jan 9 23:07:29 PST 2017; root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64

Expected Behavior

% ruby -v
ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-darwin15]
% ruby blah.rb
"/Users/xxxxxx/Desktop/__dir__test"
"/Users/xxxxxx/Desktop/__dir__test"

Actual Behavior

% jruby -v
jruby 9.1.12.0 (2.3.3) 2017-06-15 33c6439 Java HotSpot(TM) 64-Bit Server VM 25.121-b13 on 1.8.0_121-b13 +jit [darwin-x86_64]
% jruby blah.rb
"."
"/Users/xxxxxx/Desktop/__dir__test"

Reference

http://ruby-doc.org/core-2.3.3/Kernel.html#method-i-__dir__

 __dir__

Returns the canonicalized absolute path of the directory of the file from which this 
method is called. It means symlinks in the path is resolved. If __FILE__ is nil, it 
returns nil. The return value equals to File.dirname(File.realpath(__FILE__)).
@kares

This comment has been minimized.

Copy link
Member

kares commented Jul 27, 2017

... if someone is about to look into this there's some details at monkstone#1

@kares kares self-assigned this Jun 13, 2018

@kares kares added this to the JRuby 9.2.1.0 milestone Jun 13, 2018

@kares kares closed this in d5c7aff Jun 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.