From 86ff142f8efb9047105709378c95f27a697ea578 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 23 May 2023 12:45:51 +0200 Subject: [PATCH] Utils: Treat FilePath with variables as user input when expanding When macro-expanding FilePaths with environment variables, it can happen that non-conformant path separators end up in the intermediate expanded string. For example with "%{Env:PROGRAMFILES}" on Windows. Since we generally treat paths from environment variables as user input, it makes sense to treat macros as user input as-well in this case. Change-Id: I0daa57b7dbf3d8fd25c98fb82b2beb1bc6ded825 Reviewed-by: Reviewed-by: hjk --- src/libs/utils/macroexpander.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/utils/macroexpander.cpp b/src/libs/utils/macroexpander.cpp index 43d23d2d190..5d3bba0229a 100644 --- a/src/libs/utils/macroexpander.cpp +++ b/src/libs/utils/macroexpander.cpp @@ -275,7 +275,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. - return FilePath::fromString(expand(fileNameWithVariables.toString())); + return FilePath::fromUserInput(expand(fileNameWithVariables.toString())); } QByteArray MacroExpander::expand(const QByteArray &stringWithVariables) const