1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-22 22:43:01 +02: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

@@ -308,6 +308,11 @@ bool ShuttleCli::ExchangeWithMaster(const wxString & Name)
terminator = wxT('"'); terminator = wxT('"');
j++; j++;
} }
else if(mParams.GetChar(j) == wxT('\'')) // or by single quotes.
{
terminator = wxT('\'');
j++;
}
i=j; i=j;
while( j<(int)mParams.Length() && mParams.GetChar(j) != terminator ) while( j<(int)mParams.Length() && mParams.GetChar(j) != terminator )
j++; j++;

View File

@@ -150,9 +150,23 @@ void CommandBuilder::BuildCommand(const wxString &cmdName,
Failure(wxT("Unrecognized parameter: '") + paramName + wxT("'")); Failure(wxT("Unrecognized parameter: '") + paramName + wxT("'"));
return; 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); cmdParams = cmdParams.Mid(splitAt+1);
splitAt = cmdParams.Find(wxT(' ')); if( cmdParams.IsEmpty() )
if (splitAt < 0) 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(); splitAt = cmdParams.Len();
} }