On 09/07/2011 08:17 AM, Julien Rioux wrote:
On 07/09/2011 12:13 AM, Tommaso Cucinotta wrote:
Il 06/09/2011 18:26, Richard Heck ha scritto:
I know it seems counter-intuitive. What I observed was that, if
isZippedFile() returns true, then LyX thinks the file is zipped and
it needs to unzip it before doing anything with it -- maybe this is
ok if I have something like "myfigure.eps.gz", or "myfigure.svg.gz",
etc.. Now, when I detect (by extension for now) that the file is in a
zipped format that is normally managed in its zipped form by tools
(e.g., converters, visualizers), then I simply return false,
pretending the file is not zipped. This way LyX doesn't try to unzip
it, and it calls the converter properly.
Oh, I see. Perhaps it should be renamed something like
"needsDecompression()" or "needsUnzip()", then.
In the attached patch upgrade:
-) this extensions check was moved to a dontUnzip() method;
-) such method has been placed into Format.{h,cpp} as a static method,
as it seems to have more to do with formats-related logics rather than
with low-level file operations;
-) sxd has been supported and tested equally well as odg
Any further suggested modification ?
I think the suggestion from Richard to use needsUnzip (or perhaps
needsUnzipping) is a little better than what you have used
(dontUnzip). Since the name dontUnzip has a negative it is kind of
inverse logic. You can see this in the way you use it, too, since you
have to negate it to !dontUnzip.
On a more general note, it might make sense to introduce a flag for
zipped formats in preference files, in the same way that we have a
flag for e.g. vector formats. This would remove the hardcoding in the
c++ code. It's also easy to add a checkbox for it in the preference
panels, if necessary.
That is a really good idea! We should always avoid hardcoding this kind
of thing where possible.
Richard