Revert "Utils: Expand FilePaths per part, not as a full string"

This reverts commit e8855f97d5.

Reason for revert: Since no one remembers what potential side effects
there may have been, and the commit in general makes "expand" worse.

The problem with e8855f97d5 is when
"fileNameWithVariables" contains something like "%{ProjectDirectory}",
which expands to e.g. `docker://image/some/path`, we cannot rely on
"fromParts" to do the right thing. It will write everything into the
corresponding slot of a FilePath no matter what the content is, so the
"docker://" wil become part of the path, and not be recognized as the
scheme.

Change-Id: I72aeba0ed6c4a6c9a9e5ecb52b3e8e4043ae5669
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-10-17 05:22:53 +00:00
parent 9b6bbc181b
commit 3d5e7a9f66

View File

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