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:
Java::JavaLang::IllegalArgumentException: Neither current working directory (null) nor pathname (/foo/bar/baz/jruby.com) led to an absolute path
The text was updated successfully, but these errors were encountered:
@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.
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.