Dir.foreach fails in jar files #515

Closed
byteit101 opened this Issue Jan 25, 2013 · 3 comments

Projects

None yet

2 participants

@byteit101
Member

If I package a file with the contents below in a jar file (jruby-complete)

Dir.foreach File.dirname(__FILE__) do |file|
  p file
end

Running it I get the error:

Errno::ENOENT: No such file or directory - No such directory: file:/path/to/the.jar!/
initialize at org/jruby/RubyDir.java:149
foreach at org/jruby/RubyDir.java:527
(root) at classpath:jar-bootstrap.rb:1

It appears Dir.foreach does not like embedded jar paths.
Discovered in this JRubyFX comment

@enebo
Member
enebo commented Feb 28, 2013

I remember this issue like it was a month ago :)

Ok here is what I did:

  1. Made a file a.rb containing your snippet
  2. In a collection of other .rb files I created a jar: 'jar cf foo.jar *.rb'
  3. jruby -e "require 'foo.jar'; require 'a'"

This worked fine. Patrick, is there a way you can retest this? I would be really surprised if this was incidentally fixed in the last month so I suspect there is another detail I need to properly reproduce it.

@enebo
Member
enebo commented Feb 28, 2013

Ah nevermind. I did something stupid.

@enebo
Member
enebo commented Mar 4, 2013

Uwe fixed this during the weekend in commit f0e3aa3.

@enebo enebo closed this Mar 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment