Il 07/09/2011 14:17, Julien Rioux ha scritto:
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.
Of course my first attempt tries to not change file formats nor
preferences format.
Actually, I also feel that there is some clash between the need for
supporting ".eps.gz", that introduces this automagic unzipping, and the
natively zipped encoding of some image formats.
The problem is that the logic behind guessFormatFromFile() tries
immediately to uncompress a file if it is compressed. I'm not sure about
this, but I suspect there's not way to understand it is actually an
OpenOffice compressed archive, till you inspect its internal directory
tree and you recognize some standard XML contents. On the other hand,
checking the extension is simply trivial and very efficient. Also, why
don't we use the "file" tool, or the libmagic library to detect file
formats from the contents ?
T.