Update pleditor path for run from build directory

(cherry picked from commit 3a2dbf7786)
This commit is contained in:
Ian McInerney 2019-10-03 19:27:23 +02:00 committed by Wayne Stambaugh
parent 078045f73b
commit 69d0446019
1 changed files with 27 additions and 0 deletions

View File

@ -94,6 +94,7 @@ void KIWAY::SetTop( wxFrame* aTop )
const wxString KIWAY::dso_search_path( FACE_T aFaceId )
{
const char* name;
const char* dirName;
switch( aFaceId )
{
@ -110,6 +111,13 @@ const wxString KIWAY::dso_search_path( FACE_T aFaceId )
return wxEmptyString;
}
// The subdirectories usually have the same name as the kiface
switch( aFaceId )
{
case FACE_PL_EDITOR: dirName = "pagelayout_editor"; break;
default: dirName = name + 1; break;
}
#ifndef __WXMAC__
wxString path;
@ -131,6 +139,25 @@ const wxString KIWAY::dso_search_path( FACE_T aFaceId )
fn.SetName( name );
#ifdef DEBUG
// To speed up development, it's sometimes nice to run kicad from inside
// the build path. In that case, each program will be in a subdirectory.
// To find the DSOs, we need to go up one directory and then enter a subdirectory.
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
{
#ifdef __WXMAC__
fn = wxStandardPaths::Get().GetExecutablePath();
fn.RemoveLastDir();
fn.AppendDir( wxT( "PlugIns" ) );
fn.SetName( name );
#else
fn.RemoveLastDir();
fn.AppendDir( dirName );
#endif
}
#endif
// Here a "suffix" == an extension with a preceding '.',
// so skip the preceding '.' to get an extension
fn.SetExt( KIFACE_SUFFIX + 1 ); // + 1 => &KIFACE_SUFFIX[1]