After upgrading from 1.2.0 -> 1.5.x, loading using relative paths is
not working the same way as before:
$ jruby1.2 -Isubdir subdir/main.rb
$ jruby1.5.3 -Isubdir subdir/main.rb
subdir/main.rb:1:in `load’: No such file to load – …/hi.rb
I tracked this change down to a commit between 1.3 and 1.4, in
I have no real doubt that change was needed (it’s more consistent with
MRI), just wondering of a way around this…
I’m embedding JRuby into an app where I’d prefer to resolve those ‘…’
paths relative to the script loading them rather than relying on pwd.
To support ‘…’ in require/load, do I have to cwd to the dir where
script is? Or is there a nicer way?
There seems to be some relevant code in LoadService to handle
relative paths, eg. end of init():
// “.” dir is used for relative path loads from a given file, as in
but I don’t see how that comes into play as that change I mentioned
above seems to inhibit the effect of “.” Loadpath entries.
For cwd, ScriptingContainer has a method setCurrentDirectory() but
this doesn’t have any effect if called after any ‘put()’ calls (I
guess due to lazy initialization of the runtime).
Is this intended / documented?
Should I use to container.getRuntime().setCurrentDirectory() instead?
(this seems deprecated though)
Any clarifications are welcome. Thanks,
To unsubscribe from this list, please visit: