qt: fix cover generation on windows

in previous code, for path "C:/image.jpg", the url scheme will be "C" and
the call to QQmlFile::urlToLocalFileorQrc with fail since url scheme is not "file"
but the provided input path is valid file path, fix such cases
This commit is contained in:
Prince Gupta 2022-05-18 19:44:13 +05:30 committed by Jean-Baptiste Kempf
parent d305611d6d
commit 0caa9ea0e6
1 changed files with 2 additions and 2 deletions

View File

@ -272,8 +272,8 @@ void CoverGenerator::drawImage(QPainter & painter, const QString & fileName, con
{
//QFile expect the :/ instead of qrc:// for resources files
const QUrl fileURL {fileName};
const QString adaptedFilename = fileURL.scheme().isEmpty() ? fileName : QQmlFile::urlToLocalFileOrQrc(fileURL);
QFile file(adaptedFilename);
const QString adaptedFilename = QQmlFile::urlToLocalFileOrQrc(fileURL);
QFile file(adaptedFilename.isEmpty() ? fileName : adaptedFilename);
if (file.open(QIODevice::ReadOnly) == false)
{