|
KiCad PCB EDA Suite
|
Helper functions to substitute paths with environmental variables. More...
Go to the source code of this file.
Functions | |
| wxString KICOMMON_API | NormalizePath (const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const PROJECT *aProject) |
| Normalize a file path to an environmental variable, if possible. | |
| wxString KICOMMON_API | NormalizePath (const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath) |
| Normalize a file path to an environmental variable, if possible. | |
| wxString KICOMMON_API | MakeRelativePath (const wxString &aPath, const wxString &aBaseDir) |
| Express an absolute path relative to a base directory, stepping out with ".." when needed. | |
| wxString KICOMMON_API | NormalizePathForProject (const wxString &aPath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath, bool aAllowParentDirs) |
| Choose how to store a path the user picked for a project. | |
| wxString KICOMMON_API | ResolveFile (const wxString &aFileName, const ENV_VAR_MAP *aEnvVars, const PROJECT *aProject) |
| Search the default paths trying to find one with the requested file. | |
Helper functions to substitute paths with environmental variables.
Definition in file env_paths.h.
| wxString KICOMMON_API MakeRelativePath | ( | const wxString & | aPath, |
| const wxString & | aBaseDir ) |
Express an absolute path relative to a base directory, stepping out with ".." when needed.
The result always uses '/' separators so a path stored in a shared file works on every platform.
| aPath | is the absolute file or directory path to convert. |
| aBaseDir | is the absolute directory the result is relative to. |
Definition at line 152 of file env_paths.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), NormalizePathForProject(), and DIALOG_DESTINATION::onOutputPathBrowseClicked().
| wxString KICOMMON_API NormalizePath | ( | const wxFileName & | aFilePath, |
| const ENV_VAR_MAP * | aEnvVars, | ||
| const PROJECT * | aProject ) |
Normalize a file path to an environmental variable, if possible.
| aFilePath | is the full file path (path and file name) to be normalized. |
| aEnvVars | is an optional map of environmental variables to try substitution with. |
| aProject | is an optional project, to normalize the file path to the project path. |
Definition at line 142 of file env_paths.cpp.
References PROJECT::GetProjectPath(), and NormalizePath().
| wxString KICOMMON_API NormalizePath | ( | const wxFileName & | aFilePath, |
| const ENV_VAR_MAP * | aEnvVars, | ||
| const wxString & | aProjectPath ) |
Normalize a file path to an environmental variable, if possible.
| aFilePath | is the full file path (path and file name) to be normalized. |
| aEnvVars | is an optional map of environmental variables to try substitution with. |
| aProjectPath | is an optional string to normalize the file path to the project path. |
Definition at line 73 of file env_paths.cpp.
References normalizeAbsolutePaths(), and PROJECT_VAR_NAME.
Referenced by DESIGN_BLOCK_PANE::AddDesignBlockLibrary(), PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_LIBRARY_MANAGER::addLibrary(), SYMBOL_EDIT_FRAME::addLibTableEntry(), PANEL_SYM_LIB_TABLE::appendLibraryRow(), BOOST_AUTO_TEST_CASE(), PANEL_DESIGN_BLOCK_LIB_TABLE::browseLibrariesHandler(), PANEL_FP_LIB_TABLE::browseLibrariesHandler(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), NormalizePath(), NormalizePathForProject(), TEXT_BUTTON_FILE_BROWSER::OnButtonClick(), PANEL_SYM_LIB_TABLE::onConvertLegacyLibraries(), PANEL_DESIGN_BLOCK_LIB_TABLE::onMigrateLibraries(), PANEL_FP_LIB_TABLE::onMigrateLibraries(), and SYMBOL_EDIT_FRAME::replaceLibTableEntry().
| wxString KICOMMON_API NormalizePathForProject | ( | const wxString & | aPath, |
| const ENV_VAR_MAP * | aEnvVars, | ||
| const wxString & | aProjectPath, | ||
| bool | aAllowParentDirs ) |
Choose how to store a path the user picked for a project.
A path inside the project is always made relative to it. Otherwise an environment variable substitution is preferred, then a path climbing out of the project with ".." when aAllowParentDirs is set, and finally the absolute path.
| aPath | is the absolute file or directory path to store. |
| aEnvVars | is an optional map of environment variables to try substitution with. |
| aProjectPath | is the absolute project directory, or empty when there is no project. |
| aAllowParentDirs | permits a relative path that leaves the project directory. |
Definition at line 170 of file env_paths.cpp.
References MakeRelativePath(), and NormalizePath().
Referenced by BOOST_AUTO_TEST_CASE(), DIALOG_DESTINATION::onOutputPathBrowseClicked(), and DIALOG_PAGES_SETTINGS::OnWksFileSelection().
| wxString KICOMMON_API ResolveFile | ( | const wxString & | aFileName, |
| const ENV_VAR_MAP * | aEnvVars, | ||
| const PROJECT * | aProject ) |
Search the default paths trying to find one with the requested file.
| aFileName | is the name of the searched file. It might be a relative path. |
| aEnvVars | is an optional map of environmental variables that can contain paths. |
| aProject | is an optional project, to check the project path. |
Definition at line 207 of file env_paths.cpp.
References createFilePath(), and PROJECT::GetProjectPath().
Referenced by NETLIST_EXPORTER_SPICE::writeInclude().