diff options
| author | David Edmundson <[email protected]> | 2026-04-26 22:50:36 +0100 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2026-04-27 07:39:26 +0000 |
| commit | 2d7dac81ad66672aa2332cc37e3439755fe1f930 (patch) | |
| tree | db255b798de812f12c7bc321cfb263c3caa95b42 /src/dolphinmainwindow.cpp | |
| parent | 4cc003805a3ff933bf9fcf2c2f2cd609b8ea7f87 (diff) | |
Avoid string concatenation for command line building
This is prone to errors. CommandLauncherJob takes care of it with the
right syntax.
Diffstat (limited to 'src/dolphinmainwindow.cpp')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 9 |
1 files 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(); } |
