Fix system scripting plugin path on Windows and Linux.

This commit is contained in:
Brian Sidebotham 2015-10-01 15:21:00 -04:00 committed by Wayne Stambaugh
parent ea005bc94d
commit 28bda90e87
1 changed files with 14 additions and 4 deletions

View File

@ -249,7 +249,7 @@ static bool scriptingSetup()
// which are ( [KICAD_PATH] is an environment variable to define) // which are ( [KICAD_PATH] is an environment variable to define)
// [KICAD_PATH]/scripting/plugins // [KICAD_PATH]/scripting/plugins
// Add this default search path: // Add this default search path:
path_frag = Pgm().GetExecutablePath() + wxT( "scripting/plugins" ); path_frag = Pgm().GetExecutablePath() + wxT( "../share/kicad/scripting/plugins" );
#elif defined( __WXMAC__ ) #elif defined( __WXMAC__ )
// User plugin folder is ~/Library/Application Support/kicad/scripting/plugins // User plugin folder is ~/Library/Application Support/kicad/scripting/plugins
@ -272,17 +272,27 @@ static bool scriptingSetup()
wxT( "Contents/Frameworks/python/site-packages" ); wxT( "Contents/Frameworks/python/site-packages" );
// Original content of $PYTHONPATH // Original content of $PYTHONPATH
if( wxGetenv("PYTHONPATH") != NULL ) if( wxGetenv( wxT( "PYTHONPATH" ) ) != NULL )
{ {
pypath = wxString( wxGetenv("PYTHONPATH") ) + wxT( ":" ) + pypath; pypath = wxString( wxGetenv( wxT( "PYTHONPATH" ) ) ) + wxT( ":" ) + pypath;
} }
// set $PYTHONPATH // set $PYTHONPATH
wxSetEnv( "PYTHONPATH", pypath ); wxSetEnv( "PYTHONPATH", pypath );
#else #else
/* Linux-specific setup */
wxString pypath;
pypath = Pgm().GetExecutablePath() + wxT( "../lib/python2.7/dist-packages" );
if( !wxIsEmpty( wxGetenv("PYTHONPATH") ) )
pypath = wxString( wxGetenv("PYTHONPATH") ) + wxT( ":" ) + pypath;
wxSetEnv( "PYTHONPATH", pypath );
// Add this default search path: // Add this default search path:
path_frag = wxT( "/usr/local/kicad/bin/scripting/plugins" ); path_frag = Pgm().GetExecutablePath() + wxT( "../share/kicad/scripting/plugins" );
#endif #endif
if( ! pcbnewInitPythonScripting( TO_UTF8( path_frag ) ) ) if( ! pcbnewInitPythonScripting( TO_UTF8( path_frag ) ) )