Fix "Broken filename passed to function" message for qmake -tp vc

Since commit 9ab043b6 we're checking for invalid file paths passed to
Qt's file system engine. When initializing the deployment tool for VS
projects we accidentally passed a file path containing '\0'. Fix that by
using an infix QString, not QChar.

Change-Id: Ieae066d20ac290354febd420abce68f28649b365
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This commit is contained in:
Joerg Bornemann 2019-12-02 15:27:43 +01:00
parent 868ded6d87
commit 542d14bd02

View File

@ -1247,10 +1247,10 @@ void VcprojGenerator::initDeploymentTool()
+ "|" + targetPath + "|" + targetPath
+ "|0;"; + "|0;";
if (!qpaPluginDeployed) { if (!qpaPluginDeployed) {
QChar debugInfixChar; QString debugInfix;
bool foundGuid = dllName.contains(QLatin1String("Guid")); bool foundGuid = dllName.contains(QLatin1String("Guid"));
if (foundGuid) if (foundGuid)
debugInfixChar = QLatin1Char('d'); debugInfix = QLatin1Char('d');
if (foundGuid || dllName.contains(QLatin1String("Gui"))) { if (foundGuid || dllName.contains(QLatin1String("Gui"))) {
QFileInfo info2; QFileInfo info2;
@ -1258,13 +1258,14 @@ void VcprojGenerator::initDeploymentTool()
QString absoluteDllFilePath = dllPath.toQString(); QString absoluteDllFilePath = dllPath.toQString();
if (!absoluteDllFilePath.endsWith(QLatin1Char('/'))) if (!absoluteDllFilePath.endsWith(QLatin1Char('/')))
absoluteDllFilePath += QLatin1Char('/'); absoluteDllFilePath += QLatin1Char('/');
absoluteDllFilePath += QLatin1String("../plugins/platforms/qwindows") + debugInfixChar + QLatin1String(".dll"); absoluteDllFilePath += QLatin1String("../plugins/platforms/qwindows")
+ debugInfix + QLatin1String(".dll");
info2 = QFileInfo(absoluteDllFilePath); info2 = QFileInfo(absoluteDllFilePath);
if (info2.exists()) if (info2.exists())
break; break;
} }
if (info2.exists()) { if (info2.exists()) {
conf.deployment.AdditionalFiles += QLatin1String("qwindows") + debugInfixChar + QLatin1String(".dll") conf.deployment.AdditionalFiles += QLatin1String("qwindows") + debugInfix + QLatin1String(".dll")
+ QLatin1Char('|') + QDir::toNativeSeparators(info2.absolutePath()) + QLatin1Char('|') + QDir::toNativeSeparators(info2.absolutePath())
+ QLatin1Char('|') + targetPath + QLatin1String("\\platforms") + QLatin1Char('|') + targetPath + QLatin1String("\\platforms")
+ QLatin1String("|0;"); + QLatin1String("|0;");