-
-
Notifications
You must be signed in to change notification settings - Fork 925
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[] fails if path does not exist instead of returning nil #2291
Comments
@djberg96 You missed the window by a few days and I can confirm this is broken on windows only. In doing a quick look I think this must have been broken for a long time/forever? We pass a null cwd in part of the globbing logic and I think that is part of the problem (although I am not positive that is the root cause). I targeted for next point release since you should not see such basic errors like this in JRuby anymore... |
Thanks for the update enebo. I'm not sure how long it's been broken. I smoked it out when running the test suite for the ptools library. I -thought- I had done that before with JRuby and it worked, but I guess not. |
It is possible it worked at some point but the explicit null for cwd made me think not. |
Perhaps only on Windows? On OS X:
|
yeah only on windows...I should have marked it as such. I figured @djberg96 filing the issue was the same thing though :) |
So I fixed this by putting in a special check that if the absolute file glob path check is "/" try and use Windows system drive letter as the CWD (if system drive is not specified in env I fall back to good ole C:). I opened up #2335 so that we can make sure this works for more than glob. What is weird is I went back to the beginning of 1.7.x (well very close to beginning) and things like File.exist?(C:/opt) return false on jruby but true on MRI. I could have swore this worked at some point. Dir[] does return the same results as MRI when using patterns starting with just /. So I am fixing this one regression with the hopes we can improve windows compat in 1.7.19. |
jruby 1.7.16 (1.9.3p392) 2014-09-25 575b395 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_07-b10 +jit [Windows 7-amd64]
MRI returns nil if you pass a non-existant path to Dir[]. However, JRuby gets quite upset:
The text was updated successfully, but these errors were encountered: