From 8a8775bed8288295fb2c3829f277feba9086c5d3 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 15 Oct 2021 10:38:41 +0100 Subject: [PATCH] Remove another use of non-argv wxExecute (Fixes supplied by mwielgus.) --- common/gestfich.cpp | 2 +- common/launch_ext.cpp | 3 ++- kicad/tools/kicad_manager_control.cpp | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/gestfich.cpp b/common/gestfich.cpp index 7aef617c83..1ce563b27b 100644 --- a/common/gestfich.cpp +++ b/common/gestfich.cpp @@ -145,7 +145,7 @@ int ExecuteFile( const wxString& aEditorName, const wxString& aFileName, wxProce args[i] = nullptr; - return wxExecute( const_cast< wchar_t**>( args ), wxEXEC_ASYNC, aCallback ); + return wxExecute( const_cast( args ), wxEXEC_ASYNC, aCallback ); } wxString msg; diff --git a/common/launch_ext.cpp b/common/launch_ext.cpp index d1dc541f0f..e73280d139 100644 --- a/common/launch_ext.cpp +++ b/common/launch_ext.cpp @@ -25,7 +25,8 @@ void LaunchExternal( const wxString& aPath ) { #ifdef __WXMAC__ - wxExecute( wxString::Format( "open \"%s\"", aPath ) ); + const wchar_t* args[] = { L"open", L"--args", aPath.wc_str() }; + wxExecute( const_cast( args ) ); #else wxString path( aPath ); diff --git a/kicad/tools/kicad_manager_control.cpp b/kicad/tools/kicad_manager_control.cpp index 1503203532..19b30ab6df 100644 --- a/kicad/tools/kicad_manager_control.cpp +++ b/kicad/tools/kicad_manager_control.cpp @@ -790,9 +790,9 @@ int KICAD_MANAGER_CONTROL::Execute( const TOOL_EVENT& aEvent ) m_frame->PrintMsg( msg ); #ifdef __WXMAC__ - // Use concatenation to avoid double-quote bug in wxWidgets 3.1.5 OSX. - wxExecute( "osascript -e 'activate application \"" - + EscapeString( execFile, CTX_QUOTED_STR ) + "\"' " ); + // This non-parameterized use of wxExecute is fine because execFile is not derived + // from user input. + wxExecute( "osascript -e 'activate application \"" + execFile + "\"'" ); #endif } else