mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 08:16:16 -07:00
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.
This commit is contained in:
parent
916e53c260
commit
06c704c740
1 changed files with 11 additions and 3 deletions
|
@ -481,15 +481,23 @@ void Application::runExternalProgram(const BitTorrent::Torrent *torrent) const
|
||||||
});
|
});
|
||||||
proc.startDetached();
|
proc.startDetached();
|
||||||
#else // Q_OS_WIN
|
#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())
|
if (args.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (QString &arg : args)
|
for (QString &arg : args)
|
||||||
arg = replaceVariables(arg);
|
{
|
||||||
|
// strip redundant quotes
|
||||||
|
if (arg.startsWith(u'"') && arg.endsWith(u'"'))
|
||||||
|
arg = arg.mid(1, (arg.size() - 2));
|
||||||
|
|
||||||
LogMsg(logMsg.arg(torrent->name(), args.join(u' ')));
|
arg = replaceVariables(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// show intended command in log
|
||||||
|
LogMsg(logMsg.arg(torrent->name(), replaceVariables(program)));
|
||||||
|
|
||||||
const QString command = args.takeFirst();
|
const QString command = args.takeFirst();
|
||||||
QProcess::startDetached(command, args);
|
QProcess::startDetached(command, args);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue