__FILE__ is wrong when using PathType.CLASSPATH so require_relative can't work #1875
If I load a file from the classpath like this:
And then this script requires other scripts:
This prints out "org/acme/app/scripts/dsl.rb" even though I would expect "classpath:/org/acme/app/scripts/dsl.rb", so require_relative is doomed to fail as the file is not on the filesystem (and indeed this does fail - it resolves the path relative to my home directory.)
I tried working around this by passing PathType.ABSOLUTE and "classpath:/org/.../dsl.rb" instead, but this doesn't work - ScriptingContainer loads this script directly, so it doesn't know that classpath is a special URL.
I'm not sure what the workaround is from here. I guess the worst case is that I accept that require_relative can't possibly work and use require with absolute paths.
The text was updated successfully, but these errors were encountered: