Do not replace delimiter " by ' inside a command string.

Fixes #9528
https://gitlab.com/kicad/code/kicad/issues/9528
This commit is contained in:
jean-pierre charras 2021-11-05 13:24:38 +01:00
parent 792a8dca9d
commit 93e163b98d
1 changed files with 10 additions and 7 deletions

View File

@ -389,6 +389,10 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
if( GetSubstOption() )
cmdK2S.Append( " --subst-models" );
// Note: for some reason, using \" to insert a quote in a format string, under MacOS
// wxString::Format does not work. So use a %c format in string
int quote = '"';
switch( orgOpt )
{
case DIALOG_EXPORT_STEP::STEP_ORG_0:
@ -415,7 +419,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
}
LOCALE_IO dummy;
cmdK2S.Append( wxString::Format( " --user-origin='%.6f x %.6f'", xOrg, yOrg ) );
cmdK2S.Append( wxString::Format( " --user-origin=%c%.6f x %.6f%c", quote, xOrg, yOrg, quote ) );
}
break;
@ -425,21 +429,20 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
xOrg = Iu2Millimeter( bbox.GetCenter().x );
yOrg = Iu2Millimeter( bbox.GetCenter().y );
LOCALE_IO dummy;
cmdK2S.Append( wxString::Format( " --user-origin='%.6f x %.6f'", xOrg, yOrg ) );
cmdK2S.Append( wxString::Format( " --user-origin=%c%.6f x %.6f%c", quote, xOrg, yOrg, quote ) );
}
break;
}
{
LOCALE_IO dummy;
cmdK2S.Append( wxString::Format( " --min-distance='%.3f mm'", tolerance ) );
cmdK2S.Append( wxString::Format( " --min-distance=%c%.3f mm%c", quote, tolerance, quote ) );
}
cmdK2S.Append( " -f -o " );
cmdK2S.Append( wxString::Format("'%s'", m_filePickerSTEP->GetPath() ) ); // input file path
cmdK2S.Append( wxString::Format( " -f -o %c%s%c", quote,
m_filePickerSTEP->GetPath(), quote ) ); // input file path
cmdK2S.Append( " " );
cmdK2S.Append( wxString::Format("'%s'", m_boardPath ) ); // output file path
cmdK2S.Append( wxString::Format( " %c%s%c",quote, m_boardPath, quote ) ); // output file path
wxExecute( cmdK2S, wxEXEC_ASYNC | wxEXEC_SHOW_CONSOLE );