Escape quotes to prevent break-out.
Fixes https://gitlab.com/kicad/code/kicad/issues/9236
This commit is contained in:
parent
07b9e2ee51
commit
1b6c4638ca
|
@ -36,6 +36,7 @@
|
|||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <gestfich.h>
|
||||
#include <string_utils.h>
|
||||
|
||||
void QuoteString( wxString& string )
|
||||
{
|
||||
|
@ -261,14 +262,14 @@ bool doPrintFile( const wxString& file, bool aDryRun )
|
|||
|
||||
if( !application.IsEmpty() )
|
||||
{
|
||||
wxString ascript;
|
||||
ascript.Printf( "osascript -e 'tell application \"%s\"' "
|
||||
"-e ' set srcFileRef to (open POSIX file \"%s\")' "
|
||||
"-e ' activate' "
|
||||
"-e ' print srcFileRef print dialog true' "
|
||||
"-e 'end tell' ",
|
||||
application,
|
||||
file );
|
||||
// Use concatenation to avoid double-quote bug in wxWidgets 3.1.5 OSX.
|
||||
wxString ascript = "osascript -e 'tell application \""
|
||||
+ EscapeString( application, CTX_QUOTED_STR ) + "\"' "
|
||||
+ "-e ' set srcFileRef to (open POSIX file \""
|
||||
+ EscapeString( file, CTX_QUOTED_STR ) + "\")' "
|
||||
+ "-e ' activate' "
|
||||
+ "-e ' print srcFileRef print dialog true' "
|
||||
+ "-e 'end tell' ";
|
||||
|
||||
if( !aDryRun )
|
||||
wxExecute( ascript );
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <tools/kicad_manager_control.h>
|
||||
#include <dialogs/dialog_template_selector.h>
|
||||
#include <gestfich.h>
|
||||
#include <string_utils.h>
|
||||
#include <paths.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/dir.h>
|
||||
|
@ -789,7 +790,9 @@ int KICAD_MANAGER_CONTROL::Execute( const TOOL_EVENT& aEvent )
|
|||
m_frame->PrintMsg( msg );
|
||||
|
||||
#ifdef __WXMAC__
|
||||
wxExecute( wxString::Format( "osascript -e 'activate application \"%s\"' ", execFile ) );
|
||||
// Use concatenation to avoid double-quote bug in wxWidgets 3.1.5 OSX.
|
||||
wxExecute( "osascript -e 'activate application \""
|
||||
+ EscapeString( execFile, CTX_QUOTED_STR ) + "\"' " );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue