From 3d5e7a9f660d8abe148f9cb316a989d593030f69 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Thu, 17 Oct 2024 05:22:53 +0000 Subject: [PATCH] Revert "Utils: Expand FilePaths per part, not as a full string" This reverts commit e8855f97d59670f8be8103bbe662de761a225f39. 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 e8855f97d59670f8be8103bbe662de761a225f39 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 --- src/libs/utils/macroexpander.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/libs/utils/macroexpander.cpp b/src/libs/utils/macroexpander.cpp index d8bfd68ee3c..09bd95bc7bd 100644 --- a/src/libs/utils/macroexpander.cpp +++ b/src/libs/utils/macroexpander.cpp @@ -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