Christian Ridderström wrote:
>> Sorry for the rambling, but I'm unsure how best to proceed. Can you
>> put me out of my misery?
> 
> I know what you're going through... if answering the questions above
> didn't help, try flipping a coin. Now, if you find that you don't
> actually want to follow the result of the coin-flip, go with your
> gut/ sub-conscious/ and implemnt the other alternative ;-)

Well the first step is to modify the code that returns the file
format. We already have a class to store useful information
about the file, FileName. Indeed, InsetExternal stores the name
of the file in a FileName variable.

I guess that I could modify that to also store 
        /** \returns the name of the file format if known to LyX
         *  or "unknown" if not recognized.
         */
        std::string const uncompressedFormat() const;

and write a little routine to generate the name of the (dummy?) 
compressed format. Eg
        FileName file = ...;
        string const format_name = buildFormatName(file);

string const buildFormatName(FileName const & file)
{
        string const uncompressed_format = file.uncompressedFormat();
        if (!file.isZipped())
                return uncompressed_format;

        string const compression = getExtFromContents(file.absFilename());
        return uncompressed_format + '_' + compression;
}

Hmmm. It all feels a little kludgy to me.

-- 
Angus

Reply via email to