Browse Source

Revise quote behavior

Now the behavior of double quotes aligns more as with issuing commands from shell/command line.
Related: https://github.com/qbittorrent/qBittorrent/pull/17453#issuecomment-1203372027

PR #17515.
adaptive-webui-19844
Chocobo1 2 years ago committed by GitHub
parent
commit
06c704c740
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      src/app/application.cpp

12
src/app/application.cpp

@ -481,15 +481,23 @@ void Application::runExternalProgram(const BitTorrent::Torrent *torrent) const @@ -481,15 +481,23 @@ void Application::runExternalProgram(const BitTorrent::Torrent *torrent) const
});
proc.startDetached();
#else // Q_OS_WIN
QStringList args = Utils::String::splitCommand(Preferences::instance()->getAutoRunProgram().trimmed());
const QString program = Preferences::instance()->getAutoRunProgram().trimmed();
QStringList args = Utils::String::splitCommand(program);
if (args.isEmpty())
return;
for (QString &arg : args)
{
// strip redundant quotes
if (arg.startsWith(u'"') && arg.endsWith(u'"'))
arg = arg.mid(1, (arg.size() - 2));
arg = replaceVariables(arg);
}
LogMsg(logMsg.arg(torrent->name(), args.join(u' ')));
// show intended command in log
LogMsg(logMsg.arg(torrent->name(), replaceVariables(program)));
const QString command = args.takeFirst();
QProcess::startDetached(command, args);

Loading…
Cancel
Save