40    m_file = wxFileName( aFile );
 
   42    if( !wxFile::Exists( 
m_file.GetFullPath() ) )
 
   45    if( !wxFile::Exists( 
m_file.GetFullPath() ) )
 
   47        m_info.Printf( 
_(
"Script file:\n%s\nnot found. Script not available."), aFile );
 
   54    wxString extension = 
m_file.GetExt().Lower();
 
   61    if( extension == wxS( 
"xsl" ) )
 
   64        m_cmd = wxString::Format( wxS( 
"xsltproc -o \"%%O%s\" \"%s\" \"%%I\"" ),
 
   68    else if( extension == wxS( 
"py" ) )
 
   72        m_cmd = wxString::Format( 
"python \"%s/%s\" \"%%I\" \"%%O%s\"",
 
   88        wxFileName python( PATHS::GetOSXKicadDataDir(), wxEmptyString );
 
   89        python.RemoveLastDir();
 
   90        python.AppendDir( wxT( 
"Frameworks" ) );
 
   91        python.AppendDir( wxT( 
"Python.framework" ) );
 
   92        python.AppendDir( wxT( 
"Versions" ) );
 
   93        python.AppendDir( wxT( 
"Current" ) );
 
   94        python.AppendDir( wxT( 
"bin" ) );
 
   95        python.SetFullName(wxT( 
"python3" ) );
 
   97        wxString interpreter = python.GetFullPath();
 
   99        wxString interpreter = wxString::FromUTF8Unchecked( PYTHON_EXECUTABLE );
 
  101        if( interpreter.IsEmpty() )
 
  102            interpreter = wxT( 
"python" ); 
 
  104        m_cmd = wxString::Format( 
"%s \"%s\" \"%%I\" \"%%O%s\"",
 
  111    else if( extension == wxS( 
"pyw" ) )
 
  114        m_cmd = wxString::Format( wxS( 
"pythonw \"%s/%s\" \"%%I\" \"%%O%s\"" ),
 
 
  131    wxFileName fn( aFile );
 
  132    wxString ext = fn.GetExt().Lower();
 
  134    for( 
const auto& pluginExt : { wxS( 
"xsl" ), wxS( 
"py" ), wxS( 
"pyw" ) } )
 
  136        if( pluginExt == ext )
 
 
  146    if( aEndSection.IsEmpty() )
 
  147        return wxEmptyString;
 
  149    wxFFile fdata( 
m_file.GetFullPath(), wxS( 
"rb" ) );        
 
  152    if( !fdata.ReadAll( &data ) )
 
  153        return wxEmptyString;
 
  155    const wxString header( wxS( 
"@package" ) );
 
  158    size_t strstart = data.find( header );
 
  160    if( strstart == wxString::npos )
 
  161        return wxEmptyString;
 
  163    strstart += header.Length();
 
  164    size_t strend = data.find( aEndSection, strstart );
 
  166    if( strend == wxString::npos )
 
  167        return wxEmptyString;
 
  170    while( data[strstart] < 
' ' )
 
  173    return data.SubString( strstart, strend - 1 );
 
 
  181    const wxString outputarg( wxS( 
"\"%O" ) );
 
  183    size_t strstart = aHeader.find( outputarg );
 
  185    if( strstart == wxString::npos )
 
  186        return wxEmptyString;
 
  188    strstart += outputarg.Length();
 
  189    size_t strend = aHeader.find( wxS( 
"\"" ), strstart );
 
  191    if( strend == wxString::npos )
 
  192        return wxEmptyString;
 
  194    return aHeader.SubString( strstart, strend - 1 );
 
 
  200    if( 
m_file.IsAbsolute() && 
m_file.Exists( wxFILE_EXISTS_REGULAR ) )
 
  202        wxLogTrace( 
BOM_TRACE, wxS( 
"%s found directly" ), 
m_file.GetFullPath() );
 
  208    if( 
test.Exists( wxFILE_EXISTS_REGULAR ) )
 
  210        wxLogTrace( 
BOM_TRACE, wxS( 
"%s found in user plugins path %s" ), 
m_file.GetFullName(),
 
  217    if( 
test.Exists( wxFILE_EXISTS_REGULAR ) )
 
  219        wxLogTrace( 
BOM_TRACE, wxS( 
"%s found in stock plugins path %s" ), 
m_file.GetFullName(),
 
  224    wxLogTrace( 
BOM_TRACE, wxS( 
"Could not find %s (checked %s, %s)" ), 
m_file.GetFullName(),
 
 
wxString m_name
Command to execute the plugin.
 
static bool IsValidGenerator(const wxString &aFile)
Return true if a file name matches a recognized plugin format.
 
wxString readHeader(const wxString &aEndSection)
Read the plugin file header.
 
bool m_isOk
Path to the plugin.
 
BOM_GENERATOR_HANDLER(const wxString &aFile)
 
wxString m_info
Plugin specific options.
 
wxFileName m_file
Path to the plugin stored in config (can be absolute or just a filename)
 
const wxString m_storedPath
User customisable name.
 
wxString m_cmd
Description of the plugin (normally from the plugin header)
 
wxFileName FindFilePath() const
Returns the calculated path to the plugin: if the path is already absolute and exists,...
 
static wxString getOutputExtension(const wxString &aHeader)
Extracts the output BOM file's extension, including the '.
 
static wxString GetUserPluginsPath()
Gets the user path for plugins.
 
static wxString GetStockPluginsPath()
Gets the stock (install) plugins path.