From e8855f97d59670f8be8103bbe662de761a225f39 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 18 Jul 2024 16:20:44 +0200 Subject: [PATCH] Utils: Expand FilePaths per part, not as a full string Avoid the potential side effects from the toString/fromUserInput round trip. Fixes: QTCREATORBUG-31259 Change-Id: Id004d71079b4ef8ac26b927921c5cd7a23531110 Reviewed-by: Christian Stenger Reviewed-by: Christian Kandeler --- src/libs/utils/macroexpander.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/macroexpander.cpp b/src/libs/utils/macroexpander.cpp index fc138974745..51a38f4f8c6 100644 --- a/src/libs/utils/macroexpander.cpp +++ b/src/libs/utils/macroexpander.cpp @@ -274,7 +274,10 @@ QString MacroExpander::expand(const QString &stringWithVariables) const FilePath MacroExpander::expand(const FilePath &fileNameWithVariables) const { // We want single variables to expand to fully qualified strings. - return FilePath::fromUserInput(expand(fileNameWithVariables.toString())); + 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); } QByteArray MacroExpander::expand(const QByteArray &stringWithVariables) const