Ugh. Another Windows thing. As you've seen, we already made a wrapper to always convert \ to /, and it's been mostly successful. The caveat is that eventually the \ needs to come back for the underlying FileSystem implementation to work correctly, and I think we're overzealous in a few places (preventing some File operations from working 100% right now). A wrapper to handle line terminators ought to be more benign, however.

On 6/14/06, Ola Bini <[EMAIL PROTECTED]> wrote:
Hi

I had a strange error with the rails-script and the files generated by it.
For some reason everything looked quite messed up, but Charles reports his
stuff work right.
I've been trying to isolate what the error is, since it's obviously
platform dependant, and I've actually found an interesting thing that
people sitting on Linux won't notice. Look at this code:

template =
File.read("d:/Project/jruby/lib/ruby/gems/1.8/gems/rails-1.1.2 /html/index.html")
puts "#{template[0..70].inspect}"

the index.html is just a convenient test-case. I run this with Ruby and the
output is this:

"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        "

but when I run it with jruby:

"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\r\n       "

As you see, JRuby preserves the Win32-line endings, which messes up a whole
slew of regexps, among them every use of the template-method on
create-command in Rails. Ouch.

So, the solution? I don't really know. My best suggestion right now is to
always wrap our File reading with a Filter that transforms from
line.separator to \n ... Not really great, but this will cause no ends of
trouble on Win32.
Actually, we can do better by only wrapping when line.separator is
different from \n ...

Regards
  Ola Bini




_______________________________________________
Jruby-devel mailing list
Jruby-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jruby-devel



--
Charles Oliver Nutter @ headius.blogspot.com
JRuby Developer @ jruby.sourceforge.net
Application Architect @ www.ventera.com
_______________________________________________
Jruby-devel mailing list
Jruby-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jruby-devel

Reply via email to