diff --git a/common/kiway.cpp b/common/kiway.cpp index 4923afca1f..ef94296ab1 100644 --- a/common/kiway.cpp +++ b/common/kiway.cpp @@ -34,6 +34,7 @@ #include #include +#include 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]