1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-13 16:16:33 +01:00

Spaces allowed in batch command parameter values now

PROVIDED you use single or double quotes around the string.
This commit is contained in:
James Crook
2018-01-18 15:30:05 +00:00
parent f9fb4b3b7d
commit f8be26a9b8
2 changed files with 21 additions and 2 deletions

View File

@@ -150,9 +150,23 @@ void CommandBuilder::BuildCommand(const wxString &cmdName,
Failure(wxT("Unrecognized parameter: '") + paramName + wxT("'"));
return;
}
// Handling of quoted strings is quite limitted.
// You start and end with a " or a '.
// There is no escaping in the string.
cmdParams = cmdParams.Mid(splitAt+1);
splitAt = cmdParams.Find(wxT(' '));
if (splitAt < 0)
if( cmdParams.IsEmpty() )
splitAt =-1;
else if( cmdParams[0] == '\"' ){
cmdParams = cmdParams.Mid(1);
splitAt = cmdParams.Find(wxT('\"'))+1;
}
else if( cmdParams[0] == '\'' ){
cmdParams = cmdParams.Mid(1);
splitAt = cmdParams.Find(wxT('\''))+1;
}
else
splitAt = cmdParams.Find(wxT(' '))+1;
if (splitAt < 1)
{
splitAt = cmdParams.Len();
}