Add a mechanism to load kifaces when run from the build directory
This is useful when working on code paths that rely on KiWay communications, since you can run and debug the kicad application without needing to run an install task first.
This commit is contained in:
parent
957f868e2f
commit
dffd1179c5
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/debug.h>
|
||||
#include <wx/utils.h>
|
||||
|
||||
|
||||
KIFACE* KIWAY::m_kiface[KIWAY_FACE_COUNT];
|
||||
|
@ -131,6 +132,19 @@ 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
|
||||
// with the same name as the DSO (without the prefix).
|
||||
|
||||
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
|
||||
{
|
||||
fn.RemoveLastDir();
|
||||
fn.AppendDir( name + 1 );
|
||||
}
|
||||
#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]
|
||||
|
|
Loading…
Reference in New Issue