KiCad PCB EDA Suite
kiface_i.cpp File Reference
#include <macros.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

◆ 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 37 of file kiface_i.cpp.

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

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

Referenced by KIFACE_I::start_common().