KiCad PCB EDA Suite
kiface_i.cpp File Reference
#include <macros.h>
#include <wx/config.h>
#include <wx/stdpaths.h>
#include <kiface_i.h>
#include <pgm_base.h>
#include <systemdirsappend.h>
#include <common.h>

Go to the source code of this file.

Functions

static void setSearchPaths (SEARCH_STACK *aDst, KIWAY::FACE_T aId)
 Initialize aDst SEARCH_STACK with KIFACE (DSO) specific settings. More...
 

Function Documentation

static void setSearchPaths ( SEARCH_STACK aDst,
KIWAY::FACE_T  aId 
)
static

Initialize aDst SEARCH_STACK with KIFACE (DSO) specific settings.

A non-member function so it an be moved easily, plus it's nobody's business.

Definition at line 38 of file kiface_i.cpp.

References SEARCH_STACK::AddPaths(), KIWAY::FACE_CVPCB, KIWAY::FACE_PCB, KIWAY::FACE_SCH, and SystemDirsAppend().

Referenced by KIFACE_I::start_common().

39 {
40  SEARCH_STACK bases;
41 
42  SystemDirsAppend( &bases );
43  aDst->Clear();
44 
45  for( unsigned i = 0; i < bases.GetCount(); ++i )
46  {
47  wxFileName fn( bases[i], wxEmptyString );
48 
49  // Add schematic library file path to search path list.
50  // we must add <kicad path>/library and <kicad path>/library/doc
51  if( aId == KIWAY::FACE_SCH )
52  {
53  // Add schematic doc file path (library/doc) to search path list.
54 
55  fn.AppendDir( wxT( "library" ) );
56  aDst->AddPaths( fn.GetPath() );
57 
58  fn.AppendDir( wxT( "doc" ) );
59  aDst->AddPaths( fn.GetPath() );
60 
61  fn.RemoveLastDir();
62  fn.RemoveLastDir(); // "../../" up twice, removing library/doc/
63  }
64 
65  // Add PCB library file path to search path list.
66  if( aId == KIWAY::FACE_PCB || aId == KIWAY::FACE_CVPCB )
67  {
68  fn.AppendDir( wxT( "modules" ) );
69  aDst->AddPaths( fn.GetPath() );
70 
71  // Add 3D module library file path to search path list.
72  fn.AppendDir( wxT( "packages3d" ) );
73  aDst->AddPaths( fn.GetPath() );
74 
75  fn.RemoveLastDir();
76  fn.RemoveLastDir(); // "../../" up twice, remove modules/packages3d
77  }
78 
79  // Add KiCad template file path to search path list.
80  fn.AppendDir( wxT( "template" ) );
81  aDst->AddPaths( fn.GetPath() );
82  }
83 
84 #ifndef __WXMAC__
85  aDst->AddPaths( wxT( "/usr/local/share" ) );
86 #endif
87 
88 #if 1 && defined(DEBUG)
89  aDst->Show( "kiface" );
90 #endif
91 }
Class SEARCH_STACK looks for files in a number of places.
Definition: search_stack.h:41
pcbnew DSO
Definition: kiway.h:266
void SystemDirsAppend(SEARCH_STACK *aSearchStack)
Function SystemDirsAppend appends system places to aSearchStack in a platform specific way...
eeschema DSO
Definition: kiway.h:265
void AddPaths(const wxString &aPaths, int aIndex=-1)
Function AddPaths insert or append path(s)