KiCad PCB EDA Suite
kiface_base.cpp File Reference
#include <kiface_base.h>
#include <kiway.h>
#include <search_stack.h>
#include <systemdirsappend.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

◆ setSearchPaths()

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 33 of file kiface_base.cpp.

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

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

Referenced by KIFACE_BASE::start_common().