mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-18 18:35:14 +08: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
@ -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)
|
||||
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();
|
||||
QProcess::startDetached(command, args);
|
||||
|
Loading…
Reference in New Issue
Block a user