Windeployqt: Prevent '.' and '..' from being added to lconvert

If windeployqt is not able to retrieve any translation information
from the catalog, the translationNameFilters will be empty. This allows
the '.' and '..' folders to be passed to lconvert which in turn causes
an error for the whole deployment. Added a check for the filters being
empty, and a warning in case we have to preemptively return from the
translation deployment.

Fixes: QTBUG-112204
Pick-to: 6.5
Change-Id: I0d114186e630cc3696250006fa093c4c596eb40d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Timothée Keller 2023-03-24 15:27:40 +01:00
parent a81fa2047b
commit 8009561029

View File

@ -995,7 +995,12 @@ static bool deployTranslations(const QString &sourcePath, const ModuleBitset &us
if (options.json)
options.json->addFile(sourcePath + u'/' + targetFile, absoluteTarget);
arguments.append(QDir::toNativeSeparators(targetFilePath));
const QFileInfoList &langQmFiles = sourceDir.entryInfoList(translationNameFilters(usedQtModules, prefix));
const QStringList translationFilters = translationNameFilters(usedQtModules, prefix);
if (translationFilters.isEmpty()){
std::wcerr << "Warning: translation catalogs are all empty, skipping translation deployment\n";
return true;
}
const QFileInfoList &langQmFiles = sourceDir.entryInfoList(translationFilters);
for (const QFileInfo &langQmFileFi : langQmFiles) {
if (options.json) {
options.json->addFile(langQmFileFi.absoluteFilePath(),