Hi, all. Wondering if I might get a better response here than I have in the various Android forums I've poked, especially since I'd rather create a fix that works for everyone than fork Rhino just so it works for me.

As has been implied, I'm using Rhino to script an Android app. I had various issues with this under 1.6 which I fixed, but the one that keeps coming back to bite me is Messages.properties' location.

Specifically, ScriptRuntime hard-codes this to a class, then stores Messages*.properties in the jar. This seems like a good solution until Android steps in and re-invents the JVM. When aapt takes the jar, it squashes all the classes with no regard for the .properties files.

Under 1.6, I got around this by manually uncompressing the Rhino jar, copying the various properties files into a separate directory structure then adding them to the jar using aapt. This preserved the structure correctly, so the properties were on the classpath as far as ScriptRuntime is concerned.

Now, though, I can't add them as a subdirectory in my apk, so they're always at the root. I've confirmed that the 2.1 tools behave differently in this regard. As such, ScriptRuntime can't find them at its hard-coded location, and my scripting subsystem doesn't initialize. Or rather it does, I think, but I can't actually see the errors my scripts generate.

Is there an elegant fix for this that doesn't involve me building and shipping my own jar that looks for Messages.properties rather than org/mozilla/.../Messages.properties?

If one doesn't currently exist, would there be interest in a patch to 1.7R2 that makes this configurable? I'm not terribly familiar with the codebase and design, so if so then where would be the best place for such a setting? Maybe on the context so I could do something like:

cx.setMessagesLocation("/");

Or maybe both Messages.properties and org/mozilla/.../Messages.properties should be checked, with the former being a fallback should the latter not be found? Making the location configurable might be overkill, since Android seems like the only case where it would be needed, unless I'm missing some super secret Android technique that no one lets me in on. :)

Thanks.


_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to