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 <eike.ziller@qt.io>
This commit is contained in:
Cristian Adam
2025-01-09 20:51:47 +01:00
parent 5b9f6d9c33
commit 6fd2164c4a

View File

@@ -127,10 +127,10 @@ expected_str<Unarchiver::SourceAndCommand> 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()