From 2d7dac81ad66672aa2332cc37e3439755fe1f930 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sun, 26 Apr 2026 22:50:36 +0100 Subject: Avoid string concatenation for command line building This is prone to errors. CommandLauncherJob takes care of it with the right syntax. --- src/dolphinmainwindow.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index dd511ccd9..0aff2299c 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1296,13 +1296,10 @@ void DolphinMainWindow::compareFiles() QUrl urlA = items.at(0).url(); QUrl urlB = items.at(1).url(); - QString command(QStringLiteral("kompare -c \"")); - command.append(urlA.toDisplayString(QUrl::PreferLocalFile)); - command.append("\" \""); - command.append(urlB.toDisplayString(QUrl::PreferLocalFile)); - command.append('\"'); + const QString program = QStringLiteral("kompare"); + const QStringList args({QStringLiteral("-c"), urlA.toDisplayString(QUrl::PreferLocalFile), urlB.toDisplayString(QUrl::PreferLocalFile)}); - KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(command, this); + KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(program, args, this); job->setDesktopName(QStringLiteral("org.kde.kompare")); job->start(); } -- cgit v1.3