← Back to team overview

kicad-developers team mailing list archive

[Patch] Make pl_editor runnable from build directory

 

It appears that the DSO searching code couldn't find the pl_editor kiface
sine it used pagelayout_editor as the directory name instead of pl_editor
(which is what it was assuming). Here is a patch to update the DSP search
function to use the correct path for pl_editor.

-Ian
From 54886ad20bc915ebe89bdf4dd86de3021b45aef4 Mon Sep 17 00:00:00 2001
From: Ian McInerney <Ian.S.McInerney@xxxxxxxx>
Date: Thu, 3 Oct 2019 19:27:23 +0200
Subject: [PATCH] Update pleditor path for run from build directory

---
 common/kiway.cpp | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/common/kiway.cpp b/common/kiway.cpp
index b2ff4a9a0..af44301f9 100644
--- a/common/kiway.cpp
+++ b/common/kiway.cpp
@@ -95,6 +95,7 @@ void KIWAY::SetTop( wxFrame* aTop )
 const wxString KIWAY::dso_search_path( FACE_T aFaceId )
 {
     const char*   name;
+    const char*   dirName;
 
     switch( aFaceId )
     {
@@ -111,6 +112,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;
 
@@ -135,8 +143,7 @@ const wxString KIWAY::dso_search_path( FACE_T aFaceId )
 #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).
+    // 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 ) )
     {
@@ -147,7 +154,7 @@ const wxString KIWAY::dso_search_path( FACE_T aFaceId )
         fn.SetName( name );
 #else
         fn.RemoveLastDir();
-        fn.AppendDir( name + 1 );
+        fn.AppendDir( dirName );
 #endif
     }
 #endif
-- 
2.21.0


Follow ups