From 6fd2164c4a57a0bd7e08fb6beda5c12241384c5f Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Thu, 9 Jan 2025 20:51:47 +0100 Subject: [PATCH] Utils: Fix template arguments replacement for unarchiver This makes sure that paths containing spaces will not cause issues. Fixes: QTCREATORBUG-32308 Change-Id: Idf044c5e48058c620ec0a4b4154a07d088790b9c Reviewed-by: Eike Ziller --- src/libs/utils/unarchiver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/utils/unarchiver.cpp b/src/libs/utils/unarchiver.cpp index d9092e4ca95..21504439391 100644 --- a/src/libs/utils/unarchiver.cpp +++ b/src/libs/utils/unarchiver.cpp @@ -127,10 +127,10 @@ expected_str Unarchiver::sourceAndCommand(const Fi static CommandLine unarchiveCommand(const CommandLine &commandTemplate, const FilePath &sourceFile, const FilePath &destDir) { - CommandLine command = commandTemplate; - command.setArguments(command.arguments().replace("%{src}", sourceFile.path()) - .replace("%{dest}", destDir.path())); - return command; + const QStringList args = Utils::transform(commandTemplate.splitArguments(), [&](auto arg) { + return arg.replace("%{src}", sourceFile.path()).replace("%{dest}", destDir.path()); + }); + return CommandLine(commandTemplate.executable(), args); } void Unarchiver::start()