[mythtv] libmythtv/RingBuffer.cpp -> local_sub_filename() question

Thomas thom at knubbelkeks.de
Tue Dec 1 21:36:20 UTC 2009


Hello guys,

I was wondering, why we're using this code, to get the fileinfo of a
subtitle:

[code]

    const QStringList candidates = dir.entryList(el);

    QStringList::const_iterator cit = candidates.begin();

    for (; cit != candidates.end(); ++cit)

    {

        QFileInfo fi(dirName + "/" + baseName + (*cit).right(4));

        if (fi.exists() && (fi.size() >= RingBuffer::kReadTestSize))

             return fi.absoluteFilePath();

    }
[/code]

why this algorithm, to get the name:
[code]
    QFileInfo fi(dirName + "/" + baseName + (*cit).right(4));
[/code]

can't we just use:

[code]

     QFileInfo fi(dirName + "/" + *cit);
[/code]
to get the filename?

This should give us the "real" filename of the subtitle file (e.g.
"birthday(19).sub) instead of the wildcarded one (birthday?19?.sub).
It seems, that some configurations have problem with wildcards in the
fileinfo... on the other hand i didn't even found a official information
about the handling of wildcards in the qfileinfo object. I can't find out
why the person who coded that part did it that way. Maybe someone could help
me understand that part, i think I'm overseeing something.

Greetings
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mythtv.org/pipermail/mythtv-dev/attachments/20091201/b50d169d/attachment.htm>


More information about the mythtv-dev mailing list