From 28bda90e87c919551f781776ac9864059f3a1989 Mon Sep 17 00:00:00 2001 From: Brian Sidebotham Date: Thu, 1 Oct 2015 15:21:00 -0400 Subject: [PATCH] Fix system scripting plugin path on Windows and Linux. --- pcbnew/pcbnew.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 7001ecd25c..cf3ab0f836 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -249,7 +249,7 @@ static bool scriptingSetup() // which are ( [KICAD_PATH] is an environment variable to define) // [KICAD_PATH]/scripting/plugins // Add this default search path: - path_frag = Pgm().GetExecutablePath() + wxT( "scripting/plugins" ); + path_frag = Pgm().GetExecutablePath() + wxT( "../share/kicad/scripting/plugins" ); #elif defined( __WXMAC__ ) // User plugin folder is ~/Library/Application Support/kicad/scripting/plugins @@ -272,17 +272,27 @@ static bool scriptingSetup() wxT( "Contents/Frameworks/python/site-packages" ); // 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 wxSetEnv( "PYTHONPATH", pypath ); #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: - path_frag = wxT( "/usr/local/kicad/bin/scripting/plugins" ); + path_frag = Pgm().GetExecutablePath() + wxT( "../share/kicad/scripting/plugins" ); #endif if( ! pcbnewInitPythonScripting( TO_UTF8( path_frag ) ) )