#29: Support loading system files off other paths (in a JAR) than the default one -------------------------+-------------------------------------------------- Reporter: ehuelsmann | Owner: somebody Type: enhancement | Status: new Priority: major | Milestone: Component: component1 | Version: Keywords: | -------------------------+-------------------------------------------------- Alan Ruttenberg writes:
In order to enable easy packaging of a system into a jar file, one that might even be usable as an applet, a small change is needed.
Currently load-system-file can read an .abcl compiled file set from the abcl jar. Actually, it doesn't load the .abcl directly. That file is a zip file with a "top level" file with a "._" extension and a bunch of .cls files. The unpacked contents of these files live in the abcl jar, with the "._" file renamed to have the extension ".abcl". The loading happens by first loading the "._" file, a file of lisp forms, which when evaluated, in turn calls load-compiled-function on each of the component .cls files (plus does some other stuff). All of these files live in a single directory in the jar file: org/armedbear/ lisp/
I'd like to be able to load from a subdirectory of that, in which I would put my files. I can tell load-system-file to load the initial abcl file from the subdirectory, say, org/armedbear/lisp/util/, but then load-compiled-function wants to load the components from org/ armedbear/lisp. So the small change is to set *load-truename* in load- system-file, based on the supplied path, and then to use it as the pathname defaults when executing the call to load-compiled-function. It seems to do this for the case where it loads from the regular file system, but not when working with the jar file.
Once this change is in place, to package up a system, one would unjar abcl.jar, move one's compiled files in to a subdirectory of org/ armedbear/lisp, unzip all of them, rename *._ to *.abcl, and jar them back up.
One could them load a file from the jar with: (sys:load-system-file "mydir/foo.abcl")
loadCompiledFunction is defined in Lisp.java and loadSystemFile in Load.java