mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Ensure newlines are stripped from command line input
* These can be inserted via copy-paste even though Qt says that QLineEdit only does single line editing :(
This commit is contained in:
@@ -963,7 +963,7 @@ CaptureSettings CaptureDialog::Settings()
|
||||
|
||||
ret.executable = ui->exePath->text();
|
||||
ret.workingDir = ui->workDirPath->text();
|
||||
ret.commandLine = ui->cmdline->text();
|
||||
ret.commandLine = GetCommandLine();
|
||||
|
||||
ret.environment = m_EnvModifications;
|
||||
|
||||
@@ -1081,6 +1081,13 @@ void CaptureDialog::SetCommandLine(const rdcstr &cmd)
|
||||
ui->cmdline->setText(cmd);
|
||||
}
|
||||
|
||||
QString CaptureDialog::GetCommandLine()
|
||||
{
|
||||
return ui->cmdline->text()
|
||||
.replace(QLatin1Char('\n'), QLatin1Char(' '))
|
||||
.replace(QLatin1Char('\r'), QLatin1Char(' '));
|
||||
}
|
||||
|
||||
void CaptureDialog::LoadSettings(const rdcstr &filename)
|
||||
{
|
||||
SetSettings(LoadSettingsFromDisk(filename));
|
||||
@@ -1227,7 +1234,7 @@ void CaptureDialog::TriggerCapture()
|
||||
workingDir = ui->workDirPath->text();
|
||||
}
|
||||
|
||||
QString cmdLine = ui->cmdline->text();
|
||||
QString cmdLine = GetCommandLine();
|
||||
|
||||
SaveSettings(mostRecentFilename());
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ public:
|
||||
|
||||
void SetWorkingDirectory(const rdcstr &dir) override;
|
||||
void SetCommandLine(const rdcstr &cmd) override;
|
||||
QString GetCommandLine();
|
||||
void SetEnvironmentModifications(const rdcarray<EnvironmentModification> &modifications) override;
|
||||
|
||||
void SetSettings(CaptureSettings settings) override;
|
||||
|
||||
Reference in New Issue
Block a user