KiCad PCB EDA Suite
|
Look for files in a number of paths. More...
#include <search_stack.h>
Public Member Functions | |
PROJECT::ELEM | ProjectElementType () override |
wxString | FilenameWithRelativePathInSearchList (const wxString &aFullFilename, const wxString &aBaseDir) |
Return the shortest possible path which can be use later to find a full path from this SEARCH_STACK. | |
void | AddPaths (const wxString &aPaths, int aIndex=-1) |
Insert or append path(s). | |
void | RemovePaths (const wxString &aPaths) |
Remove the given path(s) from the library path list. | |
const wxString | LastVisitedPath (const wxString &aSubPathToSearch=wxEmptyString) |
A quirky function inherited from old code that seems to serve particular needs in the UI. | |
Static Public Member Functions | |
static int | Split (wxArrayString *aResult, const wxString &aPathString) |
Separate aPathString into individual paths. | |
Look for files in a number of paths.
Augments wxPathList. I chose the name because it sounded like a stack of work, as a reminder that anything you put in here means searching work at some point in time. (An alternative is to simply know where something is.)
Definition at line 42 of file search_stack.h.
void SEARCH_STACK::AddPaths | ( | const wxString & | aPaths, |
int | aIndex = -1 |
||
) |
Insert or append path(s).
aPaths | path or path list to add. paths must be separated by ";" on windows, or ":" | ";" on unix. |
aIndex | insertion point, -1 for append. |
Definition at line 119 of file search_stack.cpp.
Referenced by add_search_paths(), GlobalPathsAppend(), DESIGN_BLOCK_LIB_TABLE::LoadGlobalTable(), FP_LIB_TABLE::LoadGlobalTable(), SYMBOL_LIB_TABLE::LoadGlobalTable(), PGM_KICAD::OnPgmInit(), PROJECT_SCH::SchSearchS(), SearchHelpFileFullPath(), SystemDirsAppend(), and DIALOG_GLOBAL_LIB_TABLE_CONFIG::TransferDataToWindow().
wxString SEARCH_STACK::FilenameWithRelativePathInSearchList | ( | const wxString & | aFullFilename, |
const wxString & | aBaseDir | ||
) |
Return the shortest possible path which can be use later to find a full path from this SEARCH_STACK.
If the library path is already in the library search paths list, just add the library name to the list. Otherwise, add the library name with the full or relative path. The relative path is preferable because it preserves use of default libraries paths, when the path is a sub path of these default paths. Note we accept only sub paths not relative paths starting by ../ that are not subpaths and are outside KiCad library paths
aFullFilename | The filename with path and extension. |
aBaseDir | The absolute path on which relative paths in this SEARCH_STACK are based. |
Definition at line 69 of file search_stack.cpp.
References base_dir().
const wxString SEARCH_STACK::LastVisitedPath | ( | const wxString & | aSubPathToSearch = wxEmptyString | ) |
A quirky function inherited from old code that seems to serve particular needs in the UI.
It returns what is called the last visited directory or if aSubPathToSearch is empty, the first path in this SEARCH_STACK ( but not the CWD ).
aSubPathToSearch | is the preferred sub path to search in path list. |
Definition at line 161 of file search_stack.cpp.
References path.
Referenced by SYMBOL_EDIT_FRAME::saveLibrary().
|
inlineoverridevirtual |
Implements PROJECT::_ELEM.
Definition at line 45 of file search_stack.h.
References PROJECT::SEARCH_STACK.
void SEARCH_STACK::RemovePaths | ( | const wxString & | aPaths | ) |
Remove the given path(s) from the library path list.
aPaths | path or list of paths to remove. If list, paths must be separated by ";" on windows, or ":" | ";" on unix. |
Definition at line 100 of file search_stack.cpp.
|
static |
Separate aPathString into individual paths.
aResult | is where to put the paths, it should be empty upon entry. |
aPathString | is concatenated string with interposing ';' or ':' separators. |
Definition at line 39 of file search_stack.cpp.
References path, and PATH_SEPS.
Referenced by AddPaths(), RemovePaths(), and PROJECT_SCH::SchSearchS().