Tom and I have been kicking around a similar approach for a while. We'll have a look at your patch and get back to you. The whole CWD thing is still evolving in JRuby (since until a couple months ago it wasn't even there) but this sounds like a good way to do it.

On 5/28/06, Ola Bini <[EMAIL PROTECTED]> wrote:
Hi.

I've spent some time trying to fix alot of the java.util.File-related
issues, and fixed some stuff. I can now locally install the rake gem,
including docs without error. I think I've fixed most of the CWD error,
but I'm not sure if it will work better in multi-threaded places.

Ok, what I've done is this:
Create a new class org.jruby.util.JRubyFile, which mostly mirrors
NormalizedFile, but ALWAYS demands either an absolute path or a valid
CWD as parameter when created. (This mirror Ruby conventions for files.
For example, try x = File.new("lib"), Dir.chdir ".." and then x.read,
and this will still work, so obviously File.new captures the CWD when
it's created.
I've changed most classes to use JRubyFile instead. The exceptions to
this is Glob, RbConfigLibrary and LoadService, but these places are self
contained and it was hard to find out what semantics was needed.

There is also a fix for the RubyFileStat here, not complete though. I've
added defineMethods for ALL methods it should have, but commented out
most right now, until there is time to implement. I have also made the
semantics right, so it captures the File::Stat information at creation
time and throws an exception if the File does not exist.

Take a look and see if it works out!

Regards
Ola Bini





--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ jruby.sourceforge.net
Application Architect @ www.ventera.com

Reply via email to