On Mon, Apr 21, 2008 at 02:57:58PM -0400, Richard Heck wrote: > Martin Vermeer wrote:
> > I think it would be good to start from Enrico's script, as it doesn't > > add complexity to the core. > > > > > There's no reason not to have such a script. Indeed, it could be > integrated into LyX via something like "Export>Bundle". The bundle would > presumably be something that could then be opened and edited in the > usual way, because it's just a LyX file with an associated directory > where the bundled files are stored. > > Getting the directory structure right is what matters here. But this > should be easy. I'd propose that each inset should have its own > subdirectory, named after the inset. Of course, that script was a proof of concept and could be improved in many ways. However, I think that it already achieves most goals. It deals with child documents and allows for out of tree files in a secure manner, as the archive can be unpacked in an empty directory without harm. Notice that it could be integrated in LyX without the need for any format change. Indeed, the original directory tree can be recreated in an empty directory, and it would suffice storing some text file at the outer level (maybe named content.lnk or something like that) containing the relative path to the real (master) LyX document in the unpacked directory. LyX could unpack the archive in an empty dir (chosen by the user), check for content.lnk, read where the desired LyX document is, and simply open it. When all the paths are relative, there is no need for doing anything else. As already observed, the only problem would arise on Windows where it is not always possibile to use relative paths, due to the multiroot nature of its filesystem. However, I think that these are corner cases and, if wanted, we could just modify the LyX file for accomodating them. Anyway, I would simply avoid doing that and require that the user stores all the files used in the document on the same drive. In this way we should get a real reversibility, as we simply recreate the original tree in a new directory, such that, if the user wants to restore the files in their original position, he has only to specify the existing directory which was the root of the subtree in the archive. That's my 2 cents. I am sure that there is something that I missed or overlooked, but I think that this is the right approach as it does no real harm to the LyX sources and requires no format change. -- Enrico