Excise system() calls.

Fixes https://gitlab.com/kicad/code/kicad/issues/9236
This commit is contained in:
Jeff Young 2021-09-25 20:08:32 +01:00
parent 6bd4a77d70
commit c6bcb85562
4 changed files with 8 additions and 29 deletions

View File

@ -292,7 +292,7 @@ bool doPrintFile( const wxString& file, bool aDryRun )
file );
if( !aDryRun )
system( printCommand.c_str() );
ProcessExecute( printCommand );
return true;
}

View File

@ -25,10 +25,7 @@
void LaunchExternal( const wxString& aPath )
{
#ifdef __WXMAC__
// Quote in case there are spaces in the path.
wxString msg = "open \"" + aPath + "\"";
system( msg.c_str() );
wxExecute( wxString::Format( "open \"%s\"", aPath ) );
#else
wxString path( aPath );
@ -48,11 +45,7 @@ void LaunchExternal( const wxString& aPath )
void LaunchURL( const wxString& aUrl )
{
#ifdef __WXMAC__
wxString msg;
msg.Printf( "open %s", aUrl );
system( msg.c_str() );
wxExecute( wxString::Format( "open %s", aUrl ) );
#else
wxLaunchDefaultApplication( aUrl );
#endif

View File

@ -41,6 +41,7 @@
#include <kiplatform/environment.h>
#include <core/kicad_algo.h>
#include <paths.h>
#include <launch_ext.h>
#include "project_tree_item.h"
#include "project_tree.h"
@ -217,24 +218,7 @@ void PROJECT_TREE_PANE::onOpenDirectory( wxCommandEvent& event )
curr_dir += wxFileName::GetPathSeparator();
}
#ifdef __WXMAC__
wxString msg;
// Quote in case there are spaces in the path.
msg.Printf( "open \"%s\"", curr_dir );
system( msg.c_str() );
#else
#if !wxCHECK_VERSION( 3, 1, 0 )
// Quote in case there are spaces in the path.
// Not needed on 3.1.4, but needed in 3.0 versions
// Moreover, on Linux, on 3.1.4 wx version, adding quotes breaks
// wxLaunchDefaultApplication
QuoteString( curr_dir );
#endif
wxLaunchDefaultApplication( curr_dir );
#endif
LaunchExternal( curr_dir );
}
}

View File

@ -34,6 +34,8 @@
#include <wx/checkbox.h>
#include <wx/dir.h>
#include <wx/filedlg.h>
#include <common.h>
#ifdef PCM
#include "dialog_pcm.h"
#endif
@ -790,7 +792,7 @@ int KICAD_MANAGER_CONTROL::Execute( const TOOL_EVENT& aEvent )
#ifdef __WXMAC__
msg.Printf( "osascript -e 'activate application \"%s\"' ", execFile );
system( msg.c_str() );
ProcessExecute( msg );
#endif
}
else