Skip to content

Commit

Permalink
Add classpath:/ as an absolute path prefix. See #4000
Browse files Browse the repository at this point in the history
This does not appear to be necessary in 1.7, but in 9k if I do not
do this then require 'classpath:/somefile' fails to find the file.
Stepping through it, I see it skips the absolute path logic that
that would have handled it properly and proceeds on to load path
logic, which obviously does not find the file.
headius committed Aug 11, 2016
1 parent 00bfccf commit d4cbfd2
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -194,6 +194,10 @@ private static boolean isAbsolute(String path) {
// uri: are absolute
return true;
}
if (path.startsWith("classpath:/")) {
// classpath URLS are absolute if they start with a slash
return true;
}
return new File(path).isAbsolute();
}

1 comment on commit d4cbfd2

@presidentbeef
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@headius I don't think this fix works on Windows:

$ java -jar BrakemanPro.jar
LoadError: no such file to load -- classpath:c:/vendor/bundle/bundler/setup
           require at org/jruby/RubyKernel.java:955
  require_relative at uri:classloader:/jruby/kernel/kernel.rb:13
            <main> at classpath:/jar-bootstrap.rb:2

Please sign in to comment.