Thanks, Georg, for the comments. I'll take these into account and
re-work the code a bit. If you can point me towards the resultfile flag
in your playground, I'll have a look at that, too, though perhaps not
immediately, as there are more pressing bugs to fix before 1.5.rc1.

Richard

Georg Baum wrote:
> Am Freitag, 18. Mai 2007 21:14 schrieb José Matos:
>   
>> On Friday 18 May 2007 7:42:56 pm Richard Heck wrote:
>>     
>
>   
>>> The attached patch addresses these bugs, all of which have to do with
>>> export, viewing, and the like---ultimately, with the conversion
>>> routines. The patch introduces a new conversion flag, usetempdir, which
>>> forces the converter to do all its work in a temporary directory 
>>>       
> created
>   
>>> under the lyx_tmpbuf directory. On export, this directory is copied to
>>> the directory in which the LyX file is contained. So, if you open
>>> /path/file.lyx and File>Export>Format, you will get a directory
>>> /path/file.format.conversion/ in which all the files generated by the
>>> converter will be found (e.g. the mess that htlatex generates ends up 
>>>       
> in
>   
>>> /path/file.html.conversion/).
>>>       
>
> A flag for the name of that directory does already exist: resultdir. Please 
> use that instead of /path/file.html.conversion/.
>
>   
>>> If you're just viewing, however, you get 
>>> $LYXTMPDIR/lyx_tmpbufN/format/, and of course that will get deleted 
>>>       
> when
>   
>>> LyX exits (gracefully).
>>>
>>> As a result, the originaldir flag does not need to be used by any of 
>>>       
> our
>   
>>> converters, and it may be redundant, though there's no harm leaving it,
>>> so far as I can see.
>>>       
>
> IMHO it should be removed. It does not fit into the "copy everything to 
> temp dir" strategy, and complicates the code. In the cases when it was 
> formerly needed (a converter needed to access files in the original dir) a 
> specialized mover can be used nowadays (as is done e.g. for xfig).
>
>   
>>> As you will note, doing this involved adding a new signature to the
>>> Converters::convert() routine. I have not changed any of the other 
>>>       
> calls
>   
>>> to this: these are in Importer.cpp, insets/InsetGraphics.cpp, and
>>> insets/ExternalSupport.cpp. At least some of these will need modifying
>>> before the patch is applied, probably all of them, as I suppose
>>> usetempdir could be set for importers and graphics converters and such.
>>>       
>
> IMHO there should only be one interface, and I don't like the new one: If 
> the resulting file name is determined by the converter in some cases, then 
> why not do this always? AFAIK the callers of the converter determine the 
> result from the old name and the format extension anyway, so this should 
> be easy to change.
> Then there is some error checking missing: If the caller can't deal with a 
> converted directory (e.g. for preview) then it should check that the 
> result is indeed a file and act appropriately if that is not the case.
>
> BTW there is another problem in this area that I solved in my playground 
> branch: Some converters don't accept a commandline argument to set the 
> resulting file name, but determine it using their own rules. They only 
> work if these rules match the naming given by LyX, but will fail if a user 
> changes e.g. the extension of a format. I solved this by a new resultfile 
> flag.
>
>   
>>> There are a few other clean-up type things to be done still, too,
>>> including fixing indentation, but I haven't done that yet as it would
>>> make the diff hard to read.
>>>       
>>   This area looks a mess and I have never quite understood it 
>>     
> completely. :-)
>
> This area is a big mess indeed. AFAIK the originaldir flag never really 
> worked, and HTML export has been broken for all but the most simple cases 
> for ages.
>
> I don't want to look at the patch in detail, but the general direction is 
> sound.
>
>
> Georg
>   


-- 
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto

Reply via email to