Jürgen Spitzmüller wrote: > Georg Baum wrote: >> No, they work for both directions. > > Could you tell me how to setup a copier that copies all images to the temp > dir, then?
I know that copiers are used in general for both directions (see e.g. fig_copy.py). I have not tested the particular case of copying images, but if we look at a copier for .lyx files, I believe the following would work: - parse the .lyx file for included images - for each image: - make possibly relative image file path absolute (using the directory of the .lyx file) - determine unique file name for the temp dir (e.g. by using the temp name of the .lyx file and appending a counter) - copy the image to the temp dir - replace original image name with newly generated temp name in the copy of the .lyx file that will be written to the temp dir. In order for that to work, the copier must know the direction (temp -> original or original -> temp), because in the other direction it needs to do something similar to ext_copy.py. It could determine the direction from the two file names of the .lyx file (the base name of the temp file is always longer than the base name of the original file), or in this particular case it could simply assume that it is only called for the direction original -> temp (fig_copy.py does that). And a really clean solution would be an additional commandline flag that could be given by LyX. The question is also whether it is needed to copy all files to the temp dir. LyX does that for the files it converts itself (to prevent data loss by overwritten files). There have been several cases of that, e.g. by overwriting foo.eps when converting foo.bar, or by converters that create temporary files in an unsafe manner. This is not necessarily needed for files that are not directly converted by LyX (with a user definable converter): The already mentioned fig_copy.py does not copy images included in the .fig file, it rather replaces them by absolute paths. This works, because we know that transfig does not destroy the included images. We cannot be that sure for arbitrary image formats, but for elyxer I would suggest to do the same (assuming it behaves well of course). Georg
