Utils: Fix expansion of macros in FilePath

In the New Project wizards, we do have e.g. %{ProFile} that should
expand to {scheme}://{device}//{path-to-pro}, not to
{}://{}//{schemedevicepath-to-pro} or similar.

Task-number: QTCREATORBUG-28355
Change-Id: Idbad709f3fce583f21186a1d43f27ecac15be2ea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2022-11-28 16:48:16 +01:00
parent 0bd6d7a69f
commit a157de7877

View File

@@ -272,10 +272,8 @@ QString MacroExpander::expand(const QString &stringWithVariables) const
FilePath MacroExpander::expand(const FilePath &fileNameWithVariables) const
{
return FilePath::fromParts(
expand(fileNameWithVariables.scheme().toString()),
expand(fileNameWithVariables.host().toString()),
expand(fileNameWithVariables.path()));
// We want single variables to expand to fully qualified strings.
return FilePath::fromString(expand(fileNameWithVariables.toString()));
}
QByteArray MacroExpander::expand(const QByteArray &stringWithVariables) const